1
1
name : CI
2
- on : workflow_call
2
+ on :
3
+ workflow_call :
4
+ secrets :
5
+ codecov_token :
6
+ required : true
7
+ permissions : {}
3
8
jobs :
4
9
lint :
5
10
name : Lint source files
6
11
runs-on : ubuntu-latest
12
+ permissions :
13
+ contents : read # for actions/checkout
7
14
steps :
8
15
- name : Checkout repo
9
- uses : actions/checkout@v2
16
+ uses : actions/checkout@v4
10
17
with :
11
18
persist-credentials : false
12
19
13
20
- name : Setup Node.js
14
- uses : actions/setup-node@v2
21
+ uses : actions/setup-node@v4
15
22
with :
16
23
cache : npm
17
24
node-version-file : ' .node-version'
@@ -31,46 +38,58 @@ jobs:
31
38
- name : Spellcheck
32
39
run : npm run check:spelling
33
40
41
+ - name : Lint GitHub Actions
42
+ uses : docker://rhysd/actionlint:latest
43
+ with :
44
+ args : -color
45
+
34
46
checkForCommonlyIgnoredFiles :
35
47
name : Check for commonly ignored files
36
48
runs-on : ubuntu-latest
49
+ permissions :
50
+ contents : read # for actions/checkout
37
51
steps :
38
52
- name : Checkout repo
39
- uses : actions/checkout@v2
53
+ uses : actions/checkout@v4
40
54
with :
41
55
persist-credentials : false
42
56
43
57
- name : Check if commit contains files that should be ignored
44
58
run : |
45
- git clone --depth 1 https://github.com/github/gitignore.git &&
46
- cat gitignore/Node.gitignore $(find gitignore/Global -name "*.gitignore" | grep -v ModelSim) > all.gitignore &&
47
- if [[ "$(git ls-files -iX all.gitignore)" != "" ]]; then
48
- echo "::error::Please remove these files:"
49
- git ls-files -iX all.gitignore
59
+ git clone --depth 1 https://github.com/github/gitignore.git
60
+
61
+ rm gitignore/Global/ModelSim.gitignore
62
+ rm gitignore/Global/Images.gitignore
63
+ cat gitignore/Node.gitignore gitignore/Global/*.gitignore > all.gitignore
64
+
65
+ IGNORED_FILES=$(git ls-files --cached --ignored --exclude-from=all.gitignore)
66
+ if [[ "$IGNORED_FILES" != "" ]]; then
67
+ echo -e "::error::Please remove these files:\n$IGNORED_FILES" | sed -z 's/\n/%0A/g'
50
68
exit 1
51
69
fi
52
70
53
71
checkPackageLock :
54
72
name : Check health of package-lock.json file
55
73
runs-on : ubuntu-latest
74
+ permissions :
75
+ contents : read # for actions/checkout
56
76
steps :
57
77
- name : Checkout repo
58
- uses : actions/checkout@v2
78
+ uses : actions/checkout@v4
59
79
with :
60
80
persist-credentials : false
61
81
62
82
- name : Setup Node.js
63
- uses : actions/setup-node@v2
83
+ uses : actions/setup-node@v4
64
84
with :
65
85
cache : npm
66
86
node-version-file : ' .node-version'
67
87
68
88
- name : Install Dependencies
69
89
run : npm ci --ignore-scripts
70
90
71
- # Disabled due to https://github.com/milesj/docusaurus-plugin-typedoc-api/pull/19
72
- # - name: Check that package-lock.json doesn't have conflicts
73
- # run: npm ls --depth 999
91
+ - name : Check that package-lock.json doesn't have conflicts
92
+ run : npm ls --depth 999
74
93
75
94
- name : Run npm install
76
95
run : npm install --ignore-scripts --force --package-lock-only --engine-strict --strict-peer-deps
@@ -81,14 +100,16 @@ jobs:
81
100
integrationTests :
82
101
name : Run integration tests
83
102
runs-on : ubuntu-latest
103
+ permissions :
104
+ contents : read # for actions/checkout
84
105
steps :
85
106
- name : Checkout repo
86
- uses : actions/checkout@v2
107
+ uses : actions/checkout@v4
87
108
with :
88
109
persist-credentials : false
89
110
90
111
- name : Setup Node.js
91
- uses : actions/setup-node@v2
112
+ uses : actions/setup-node@v4
92
113
with :
93
114
node-version-file : ' .node-version'
94
115
# We install bunch of packages during integration tests without locking them
@@ -103,14 +124,16 @@ jobs:
103
124
fuzz :
104
125
name : Run fuzzing tests
105
126
runs-on : ubuntu-latest
127
+ permissions :
128
+ contents : read # for actions/checkout
106
129
steps :
107
130
- name : Checkout repo
108
- uses : actions/checkout@v2
131
+ uses : actions/checkout@v4
109
132
with :
110
133
persist-credentials : false
111
134
112
135
- name : Setup Node.js
113
- uses : actions/setup-node@v2
136
+ uses : actions/setup-node@v4
114
137
with :
115
138
cache : npm
116
139
node-version-file : ' .node-version'
@@ -126,12 +149,12 @@ jobs:
126
149
runs-on : ubuntu-latest
127
150
steps :
128
151
- name : Checkout repo
129
- uses : actions/checkout@v2
152
+ uses : actions/checkout@v4
130
153
with :
131
154
persist-credentials : false
132
155
133
156
- name : Setup Node.js
134
- uses : actions/setup-node@v2
157
+ uses : actions/setup-node@v4
135
158
with :
136
159
cache : npm
137
160
node-version-file : ' .node-version'
@@ -144,25 +167,28 @@ jobs:
144
167
145
168
- name : Upload coverage to Codecov
146
169
if : ${{ always() }}
147
- uses : codecov/codecov-action@v1
170
+ uses : codecov/codecov-action@v4
148
171
with :
149
172
file : ./coverage/coverage-final.json
150
173
fail_ci_if_error : true
174
+ token : ${{ secrets.codecov_token }}
151
175
152
176
test :
153
177
name : Run tests on Node v${{ matrix.node_version_to_setup }}
154
178
runs-on : ubuntu-latest
155
179
strategy :
156
180
matrix :
157
181
node_version_to_setup : [12, 14, 16, 17]
182
+ permissions :
183
+ contents : read # for actions/checkout
158
184
steps :
159
185
- name : Checkout repo
160
- uses : actions/checkout@v2
186
+ uses : actions/checkout@v4
161
187
with :
162
188
persist-credentials : false
163
189
164
190
- name : Setup Node.js v${{ matrix.node_version_to_setup }}
165
- uses : actions/setup-node@v2
191
+ uses : actions/setup-node@v4
166
192
with :
167
193
cache : npm
168
194
node-version : ${{ matrix.node_version_to_setup }}
@@ -173,18 +199,40 @@ jobs:
173
199
- name : Run Tests
174
200
run : npm run testonly
175
201
202
+ codeql :
203
+ name : Run CodeQL security scan
204
+ runs-on : ubuntu-latest
205
+ permissions :
206
+ contents : read # for actions/checkout
207
+ security-events : write # for codeql-action
208
+ steps :
209
+ - name : Checkout repo
210
+ uses : actions/checkout@v4
211
+ with :
212
+ persist-credentials : false
213
+
214
+ - name : Initialize CodeQL
215
+ uses : github/codeql-action/init@v3
216
+ with :
217
+ languages : ' javascript, typescript'
218
+
219
+ - name : Perform CodeQL analysis
220
+ uses : github/codeql-action/analyze@v3
221
+
176
222
build-npm-dist :
177
223
name : Build 'npmDist' artifact
178
224
runs-on : ubuntu-latest
179
225
needs : [test, fuzz, lint, integrationTests]
226
+ permissions :
227
+ contents : read # for actions/checkout
180
228
steps :
181
229
- name : Checkout repo
182
- uses : actions/checkout@v2
230
+ uses : actions/checkout@v4
183
231
with :
184
232
persist-credentials : false
185
233
186
234
- name : Setup Node.js
187
- uses : actions/setup-node@v2
235
+ uses : actions/setup-node@v4
188
236
with :
189
237
cache : npm
190
238
node-version-file : ' .node-version'
@@ -196,7 +244,7 @@ jobs:
196
244
run : npm run build:npm
197
245
198
246
- name : Upload npmDist package
199
- uses : actions/upload-artifact@v2
247
+ uses : actions/upload-artifact@v4
200
248
with :
201
249
name : npmDist
202
250
path : ./npmDist
@@ -205,14 +253,16 @@ jobs:
205
253
name : Build 'denoDist' artifact
206
254
runs-on : ubuntu-latest
207
255
needs : [test, fuzz, lint, integrationTests]
256
+ permissions :
257
+ contents : read # for actions/checkout
208
258
steps :
209
259
- name : Checkout repo
210
- uses : actions/checkout@v2
260
+ uses : actions/checkout@v4
211
261
with :
212
262
persist-credentials : false
213
263
214
264
- name : Setup Node.js
215
- uses : actions/setup-node@v2
265
+ uses : actions/setup-node@v4
216
266
with :
217
267
cache : npm
218
268
node-version-file : ' .node-version'
@@ -224,34 +274,7 @@ jobs:
224
274
run : npm run build:deno
225
275
226
276
- name : Upload denoDist package
227
- uses : actions/upload-artifact@v2
277
+ uses : actions/upload-artifact@v4
228
278
with :
229
279
name : denoDist
230
280
path : ./denoDist
231
-
232
- build-website-dist :
233
- name : Build website
234
- runs-on : ubuntu-latest
235
- steps :
236
- - name : Checkout repo
237
- uses : actions/checkout@v2
238
- with :
239
- persist-credentials : false
240
-
241
- - name : Setup Node.js
242
- uses : actions/setup-node@v2
243
- with :
244
- cache : npm
245
- node-version-file : ' .node-version'
246
-
247
- - name : Install Dependencies
248
- run : npm ci --ignore-scripts
249
-
250
- - name : Build Docs
251
- run : npm run build:website
252
-
253
- - name : Upload denoDist package
254
- uses : actions/upload-artifact@v2
255
- with :
256
- name : websiteDist
257
- path : ./websiteDist
0 commit comments