test: run database tests in CI #354
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: Test, lint and check TS | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
test: | |
services: | |
sql: | |
image: mcr.microsoft.com/mssql/server:2019-latest | |
env: | |
SA_PASSWORD: Abcd3fgH1 | |
ACCEPT_EULA: Y | |
ports: | |
- "1433:1433" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Verify SQL Server Connection | |
run: | | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Abcd3fgH1 -Q "SELECT @@VERSION" | |
continue-on-error: true | |
- name: Create db | |
run: | | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Abcd3fgH1 -Q "CREATE DATABASE tenants-leases-test" | |
continue-on-error: true | |
- name: Logs | |
run: | | |
docker logs sqlserver | |
continue-on-error: true | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run test:ci | |
- name: Run linting | |
run: npm run lint | |
- name: Check TS | |
run: npm run ts:ci |