DevOps (#103) #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
# workflow_dispatch: | |
pull_request: | |
push: | |
# branches: | |
# - master | |
paths: | |
- ".github/**" | |
- ".npmignore" | |
- "src/**" | |
- "test/**" | |
- "package*.json" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18] | |
services: | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2019-latest | |
ports: | |
- 1433:1433 | |
options: >- | |
--health-cmd "exit 0" | |
--health-interval 10s | |
--health-timeout 10s | |
--health-retries 5 | |
env: | |
SA_PASSWORD: "P@ssw0rdP@ssw0rd" | |
ACCEPT_EULA: "Y" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: config | |
run: cp .env.dev .env | |
- name: Wait for SQL Server to be ready | |
run: | | |
for i in {1..30}; do | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P P@ssw0rdP@ssw0rd -Q "SELECT 1" && break | |
sleep 1 | |
done | |
- name: Create database | |
run: | | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P P@ssw0rdP@ssw0rd -Q "CREATE DATABASE testdb" | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# cache: npm | |
- name: npm install | |
run: | | |
cp ./test/_config.github.json ./test/config.json | |
npm install | |
- name: npm test | |
run: npm test |