Skip to content

CI

CI #114

Workflow file for this run

name: CI
on:
# workflow_dispatch:
pull_request:
push:
# branches:
# - master
paths:
- ".github/**"
- ".npmignore"
- "src/**"
- "test/**"
- "package*.json"
schedule:
- cron: "0 0 * * 0"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
env:
SA_PASSWORD: "P@ssw0rdP@ssw0rd"
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: ${{ env.SA_PASSWORD }}
ACCEPT_EULA: "Y"
steps:
- uses: actions/checkout@v4
- name: Install SQL Server tools
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
- 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 ${{ env.SA_PASSWORD }} -Q "SELECT 1" && break
sleep 1
done
- name: Create database
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${{ env.SA_PASSWORD }} -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