-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (181 loc) · 5.13 KB
/
release.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
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: 20.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: 20.x
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Lint code
run: npm run lint
buildlint:
name: Check built files
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: 20.x
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Build files
run: npm run build
- name: Check built files
run: git diff-files --quiet -w
test:
name: Run tests
runs-on: ubuntu-22.04
needs:
- commitlint
- codelint
- buildlint
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm clean-install
- name: Run tests
run: npm run test -- --forbid-only
coverage:
name: Test coverage
runs-on: ubuntu-22.04
needs:
- commitlint
- codelint
- buildlint
permissions:
contents: read
pull-requests: write # to be able to comment on released pull requests
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install deps
run: npm ci
- name: Test code
run: npm run test:coverage -- --forbid-only
- name: Report coverage
run: |
echo "# Code coverage" >> $GITHUB_STEP_SUMMARY
npx nyc report | sed --expression='1d;$d' >> $GITHUB_STEP_SUMMARY
if: ${{ !cancelled() }}
runaction:
needs:
- commitlint
- codelint
- buildlint
- test
strategy:
matrix:
os: [ 'windows-2022', 'windows-2019' ]
sqlserver: [ 'sql-latest', 'sql-2022', 'sql-2019', 'sql-2017', 'sql-2016', 'sql-2014', 'sql-2012', 'sql-2008' ]
# These sqlserver versions don't work on windows-2022 (at the moment)
exclude:
- os: windows-2022
sqlserver: sql-2008
- os: windows-2022
sqlserver: sql-2012
- os: windows-2022
sqlserver: sql-2014
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install sql server
uses: ./
with:
sqlserver-version: ${{ matrix.sqlserver }}
native-client-version: 11
odbc-version: 17
install-updates: true
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
- buildlint
- test
- runaction
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: "lts/*"
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release