Skip to content

Commit

Permalink
chore(ci): run tests on github action using docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensby committed Jul 13, 2023
1 parent cf6d5a2 commit cfd6ddd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ jobs:
run: npm clean-install
- name: Lint code
run: npm run lint
unittest:
test:
name: Run unit tests
runs-on: ubuntu-latest
env:
MSSQL_USER: 'sa'
MSSQL_PASSWORD: 'yourStrong(!)Password'
MSSQL_SERVER: 'localhost'
MSSQL_PORT: '1433'
MSSQL_DATABASE: 'master'
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
sql-version: [2017, 2019, 2022]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -61,3 +68,12 @@ jobs:
run: npm clean-install
- name: Run unit tests
run: npm run test-unit
- name: Start docker container
run: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$MSSQL_PASSWORD" -p 1433:1433 -d mcr.microsoft.com/mssql/server:${{ matrix.sql-version }}-latest --name mssql
- name: Store test config
run: echo "{\"user\":\"$MSSQL_USER\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"$MSSQL_SERVER\",\"port\":\"$MSSQL_PORT\",\"database\":\"$MSSQL_DATABASE\"}" > ./test/.mssql.json
- name: Run tedious tests
run: npm run test-tedious
- name: Stop container
if: ${{ always() }}
run: docker rm -f mssql

0 comments on commit cfd6ddd

Please sign in to comment.