Skip to content

Commit 0c9ce86

Browse files
authored
Merge pull request #1541 from dhensby/pulls/sqlserver-action
ci: use sqlserver action in CI
2 parents e736c67 + 9a08da0 commit 0c9ce86

File tree

5 files changed

+36
-160
lines changed

5 files changed

+36
-160
lines changed

.github/workflows/nodejs.yml

Lines changed: 36 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
jobs:
1313
commitlint:
1414
name: Lint commits
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v3
@@ -34,7 +34,7 @@ jobs:
3434
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
3535
codelint:
3636
name: Lint code
37-
runs-on: ubuntu-latest
37+
runs-on: ubuntu-22.04
3838
steps:
3939
- name: Checkout code
4040
uses: actions/checkout@v3
@@ -51,63 +51,41 @@ jobs:
5151
run: npm run lint
5252
test-linux:
5353
name: Run tests
54-
runs-on: ubuntu-latest
54+
runs-on: ${{ matrix.os }}
55+
services:
56+
sqlserver:
57+
image: mcr.microsoft.com/${{ matrix.sqlserver == 'edge' && 'azure-sql-edge' || 'mssql/server' }}:${{ matrix.sqlserver == 'edge' && 'latest' || format('{0}-latest', matrix.sqlserver ) }}
58+
ports:
59+
- 1433:1433
60+
env:
61+
ACCEPT_EULA: Y
62+
MSSQL_SA_PASSWORD: ${{ env.MSSQL_PASSWORD }}
5563
needs:
5664
- commitlint
5765
- codelint
5866
env:
5967
MSSQL_PASSWORD: 'yourStrong(!)Password'
60-
IMAGE_NAME: ${{ matrix.sql-version == 'edge' && 'azure-sql-edge' || 'mssql/server' }}
61-
IMAGE_TAG: ${{ matrix.sql-version == 'edge' && 'latest' || format('{0}-latest', matrix.sql-version) }}
6268
strategy:
6369
matrix:
64-
node-version: [14.x, 16.x, 18.x]
65-
sql-version: [2017, 2019, 2022]
70+
os: [ubuntu-22.04]
71+
node: [14.x, 16.x, 18.x]
72+
sqlserver: [2017, 2019, 2022]
6673
steps:
6774
- name: Checkout code
6875
uses: actions/checkout@v3
6976
with:
7077
persist-credentials: false
71-
- name: Setup Node.js ${{ matrix.node-version }}
78+
- name: Setup Node.js ${{ matrix.node }}
7279
uses: actions/setup-node@v3
7380
with:
74-
node-version: ${{ matrix.node-version }}
81+
node-version: ${{ matrix.node }}
7582
cache: 'npm'
7683
- name: Install dependencies
7784
run: npm clean-install
7885
- name: Run unit tests
7986
run: npm run test-unit
80-
- name: Setup docker cache
81-
id: cache-docker
82-
uses: actions/cache@v3
83-
with:
84-
path: .docker
85-
key: docker-cache-${{ runner.os }}-${{ matrix.sql-version }}-latest
86-
- name: Save docker image
87-
if: steps.cache-docker.outputs.cache-hit != 'true'
88-
run: |
89-
mkdir .docker
90-
docker pull "mcr.microsoft.com/$IMAGE_NAME:$IMAGE_TAG"
91-
docker image save "mcr.microsoft.com/$IMAGE_NAME:$IMAGE_TAG" -o "./.docker/${{ matrix.sql-version }}.tar"
92-
- name: Load docker image
93-
if: steps.cache-docker.outputs.cache-hit == 'true'
94-
run: docker image load -i "./.docker/${{ matrix.sql-version }}.tar"
95-
- name: Start docker container
96-
run: docker run --name mssql -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$MSSQL_PASSWORD" -p 1433:1433 -d "mcr.microsoft.com/$IMAGE_NAME:$IMAGE_TAG"
9787
- name: Store test config
9888
run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"options\":{\"trustServerCertificate\":true}}" > ./test/.mssql.json
99-
- name: Wait for database to be ready
100-
run: |
101-
set +e
102-
ATTEMPT=0
103-
while [ $ATTEMPT -le 10 ]; do
104-
ATTEMPT=$(( ATTEMPT + 1 ))
105-
docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U "sa" -P "$MSSQL_PASSWORD" -q 'SELECT 1;' | grep '1 rows affected'
106-
if [ $? -eq 0 ]; then
107-
break
108-
fi
109-
sleep 1
110-
done
11189
- name: Run tedious tests
11290
run: npm run test-tedious
11391
- name: Run cli tests
@@ -125,75 +103,64 @@ jobs:
125103
# run: npm install --no-save msnodesqlv8@^2
126104
# - name: Run msnodesqlv8 tests
127105
# run: npm run test-msnodesqlv8
128-
- name: Stop container
129-
if: ${{ always() }}
130-
run: docker rm -f -v mssql
131106
test-windows:
132-
name: Run tests (Windows)
107+
name: Run tests
133108
needs:
134109
- commitlint
135110
- codelint
136111
- test-linux
137-
runs-on: 'windows-latest'
112+
runs-on: ${{ matrix.os }}
138113
env:
139114
MSSQL_PASSWORD: 'yourStrong(!)Password'
140115
strategy:
141116
matrix:
142-
arch: [x64, x86]
143-
node-version: [14.x, 16.x, 18.x]
144-
sql-version: [2017, 2019, 2022]
117+
os: [windows-2019, windows-2022]
118+
node: [14.x, 16.x, 18.x]
119+
sqlserver: [2008, 2012, 2014, 2016, 2017, 2019, 2022]
120+
# These sqlserver versions don't work on windows-2022 (at the moment)
121+
exclude:
122+
- os: windows-2022
123+
sqlserver: 2008
124+
- os: windows-2022
125+
sqlserver: 2012
126+
- os: windows-2022
127+
sqlserver: 2014
145128
steps:
146129
- name: Checkout code
147130
uses: actions/checkout@v3
148131
with:
149132
persist-credentials: false
150-
- name: Setup Node.js ${{ matrix.node-version }}
133+
- name: Setup Node.js ${{ matrix.node }}
151134
uses: actions/setup-node@v3
152135
with:
153-
architecture: ${{ matrix.arch }}
154-
node-version: ${{ matrix.node-version }}
136+
node-version: ${{ matrix.node }}
155137
cache: 'npm'
156138
- name: Install dependencies
157139
run: npm clean-install
158140
- name: Run unit tests
159141
run: npm run test-unit
160142
- name: Setup SQL Server
161-
uses: potatoqualitee/mssqlsuite@v1.7
143+
uses: tediousjs/setup-sqlserver@v1
162144
with:
163-
install: sqlengine
145+
sqlserver-version: ${{ matrix.sqlserver }}
164146
sa-password: ${{ env.MSSQL_PASSWORD }}
165-
version: ${{ matrix.sql-version }}
147+
native-client-version: 11
166148
- name: Store test config
167149
shell: bash
168-
run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"options\":{\"trustServerCertificate\":true}}" > ./test/.mssql.json
169-
- name: Wait for database to be ready
170-
shell: bash
171-
run: |
172-
set +e
173-
ATTEMPT=0
174-
while [ $ATTEMPT -le 10 ]; do
175-
ATTEMPT=$(( ATTEMPT + 1 ))
176-
sqlcmd -S localhost -U "sa" -P "$MSSQL_PASSWORD" -q 'SELECT 1;' | grep '1 rows affected'
177-
if [ $? -eq 0 ]; then
178-
break
179-
fi
180-
sleep 1
181-
done
150+
run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"requestTimeout\":30000,\"options\":{\"abortTransactionOnError\":true,\"encrypt\":false}}" > ./test/.mssql.json
182151
- name: Run tedious tests
183152
run: npm run test-tedious
184153
- name: Run cli tests
185154
run: npm run test-cli
186155
- name: Install msnodesqlv8
187-
if: ${{ matrix.sql-version != '2022' }}
188156
run: npm install --no-save msnodesqlv8@^2
189157
- name: Run msnodesqlv8 tests
190-
if: ${{ matrix.sql-version != '2022' }}
191158
run: npm run test-msnodesqlv8
192159
release:
193160
name: Release
194161
concurrency: release
195162
if: ${{ github.repository_owner == 'tediousjs' && github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
196-
runs-on: ubuntu-latest
163+
runs-on: ubuntu-22.04
197164
needs:
198165
- commitlint
199166
- codelint

.releaserc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
branches:
2-
- master
31
plugins:
42
- '@semantic-release/commit-analyzer'
53
- '@semantic-release/release-notes-generator'

appveyor.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

test/scripts/appveyor-runtests.cmd

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/scripts/appveyor-setupsql.ps1

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)