-
Notifications
You must be signed in to change notification settings - Fork 471
195 lines (192 loc) · 6.39 KB
/
nodejs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Lint, Test & Release
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
permissions:
contents: read
jobs:
commitlint:
name: Lint commits
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Lint commit
if: github.event_name == 'push'
run: npx commitlint --from HEAD~1 --to HEAD --verbose
- name: Lint commits
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
codelint:
name: Lint code
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Lint code
run: npm run lint
test-linux:
name: Run tests
runs-on: ${{ matrix.os }}
services:
sqlserver:
image: mcr.microsoft.com/${{ matrix.sqlserver == 'edge' && 'azure-sql-edge' || 'mssql/server' }}:${{ matrix.sqlserver == 'edge' && 'latest' || format('{0}-latest', matrix.sqlserver ) }}
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: ${{ env.MSSQL_PASSWORD }}
needs:
- commitlint
- codelint
env:
MSSQL_PASSWORD: 'yourStrong(!)Password'
strategy:
matrix:
os: [ubuntu-22.04]
node: [18.x, 20.x, 22.x]
sqlserver: [2017, 2019, 2022]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Run unit tests
run: npm run test-unit
- name: Store test config
run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"options\":{\"trustServerCertificate\":true}}" > ./test/.mssql.json
- name: Run tedious tests
run: npm run test-tedious
- name: Run cli tests
run: npm run test-cli
# The msnodesqlv8 tests fail with a segmentation fault
# - name: Install OBDC 17 driver
# run: |
# sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# sudo curl -o /etc/apt/sources.list.d/mssql-release.list https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list
# sudo apt-get update
# sudo apt-get install -y msodbcsql17
# env:
# ACCEPT_EULA: Y
# - name: Install msnodesqlv8
# run: npm install --no-save msnodesqlv8@^2
# - name: Run msnodesqlv8 tests
# run: npm run test-msnodesqlv8
test-windows:
name: Run tests
needs:
- commitlint
- codelint
- test-linux
runs-on: ${{ matrix.os }}
env:
MSSQL_PASSWORD: 'yourStrong(!)Password'
strategy:
matrix:
os: [windows-2019, windows-2022]
node: [18.x, 20.x, 22.x]
sqlserver: [2008, 2012, 2014, 2016, 2017, 2019, 2022]
# These sqlserver versions don't work on windows-2022 (at the moment)
exclude:
- os: windows-2022
sqlserver: 2008
- os: windows-2022
sqlserver: 2012
- os: windows-2022
sqlserver: 2014
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Run unit tests
run: npm run test-unit
- name: Setup SQL Server
uses: tediousjs/setup-sqlserver@v2
with:
sqlserver-version: ${{ matrix.sqlserver }}
sa-password: ${{ env.MSSQL_PASSWORD }}
native-client-version: 11
- name: Store test config
shell: bash
run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"requestTimeout\":30000,\"options\":{\"abortTransactionOnError\":true,\"encrypt\":false}}" > ./test/.mssql.json
- name: Run tedious tests
run: npm run test-tedious
- name: Run cli tests
run: npm run test-cli
- name: Install msnodesqlv8
if: ${{ matrix.node != '22.x' }}
run: npm install --no-save msnodesqlv8@^2
- name: Run msnodesqlv8 tests
if: ${{ matrix.node != '22.x' }}
run: npm run test-msnodesqlv8
release:
name: Release
concurrency: release
if: ${{ github.repository_owner == 'tediousjs' && github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-22.04
needs:
- commitlint
- codelint
- test-linux
- test-windows
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release