11name : CI
2- on : workflow_call
2+ on :
3+ workflow_call :
4+ secrets :
5+ codecov_token :
6+ required : true
7+ permissions : {}
38jobs :
49 lint :
510 name : Lint source files
611 runs-on : ubuntu-latest
12+ permissions :
13+ contents : read # for actions/checkout
714 steps :
815 - name : Checkout repo
9- uses : actions/checkout@v2
16+ uses : actions/checkout@v4
1017 with :
1118 persist-credentials : false
1219
1320 - name : Setup Node.js
14- uses : actions/setup-node@v2
21+ uses : actions/setup-node@v4
1522 with :
1623 cache : npm
1724 node-version-file : ' .node-version'
@@ -31,46 +38,58 @@ jobs:
3138 - name : Spellcheck
3239 run : npm run check:spelling
3340
41+ - name : Lint GitHub Actions
42+ uses : docker://rhysd/actionlint:latest
43+ with :
44+ args : -color
45+
3446 checkForCommonlyIgnoredFiles :
3547 name : Check for commonly ignored files
3648 runs-on : ubuntu-latest
49+ permissions :
50+ contents : read # for actions/checkout
3751 steps :
3852 - name : Checkout repo
39- uses : actions/checkout@v2
53+ uses : actions/checkout@v4
4054 with :
4155 persist-credentials : false
4256
4357 - name : Check if commit contains files that should be ignored
4458 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'
5068 exit 1
5169 fi
5270
5371 checkPackageLock :
5472 name : Check health of package-lock.json file
5573 runs-on : ubuntu-latest
74+ permissions :
75+ contents : read # for actions/checkout
5676 steps :
5777 - name : Checkout repo
58- uses : actions/checkout@v2
78+ uses : actions/checkout@v4
5979 with :
6080 persist-credentials : false
6181
6282 - name : Setup Node.js
63- uses : actions/setup-node@v2
83+ uses : actions/setup-node@v4
6484 with :
6585 cache : npm
6686 node-version-file : ' .node-version'
6787
6888 - name : Install Dependencies
6989 run : npm ci --ignore-scripts
7090
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
7493
7594 - name : Run npm install
7695 run : npm install --ignore-scripts --force --package-lock-only --engine-strict --strict-peer-deps
@@ -81,14 +100,16 @@ jobs:
81100 integrationTests :
82101 name : Run integration tests
83102 runs-on : ubuntu-latest
103+ permissions :
104+ contents : read # for actions/checkout
84105 steps :
85106 - name : Checkout repo
86- uses : actions/checkout@v2
107+ uses : actions/checkout@v4
87108 with :
88109 persist-credentials : false
89110
90111 - name : Setup Node.js
91- uses : actions/setup-node@v2
112+ uses : actions/setup-node@v4
92113 with :
93114 node-version-file : ' .node-version'
94115 # We install bunch of packages during integration tests without locking them
@@ -103,14 +124,16 @@ jobs:
103124 fuzz :
104125 name : Run fuzzing tests
105126 runs-on : ubuntu-latest
127+ permissions :
128+ contents : read # for actions/checkout
106129 steps :
107130 - name : Checkout repo
108- uses : actions/checkout@v2
131+ uses : actions/checkout@v4
109132 with :
110133 persist-credentials : false
111134
112135 - name : Setup Node.js
113- uses : actions/setup-node@v2
136+ uses : actions/setup-node@v4
114137 with :
115138 cache : npm
116139 node-version-file : ' .node-version'
@@ -126,12 +149,12 @@ jobs:
126149 runs-on : ubuntu-latest
127150 steps :
128151 - name : Checkout repo
129- uses : actions/checkout@v2
152+ uses : actions/checkout@v4
130153 with :
131154 persist-credentials : false
132155
133156 - name : Setup Node.js
134- uses : actions/setup-node@v2
157+ uses : actions/setup-node@v4
135158 with :
136159 cache : npm
137160 node-version-file : ' .node-version'
@@ -144,25 +167,28 @@ jobs:
144167
145168 - name : Upload coverage to Codecov
146169 if : ${{ always() }}
147- uses : codecov/codecov-action@v1
170+ uses : codecov/codecov-action@v4
148171 with :
149172 file : ./coverage/coverage-final.json
150173 fail_ci_if_error : true
174+ token : ${{ secrets.codecov_token }}
151175
152176 test :
153177 name : Run tests on Node v${{ matrix.node_version_to_setup }}
154178 runs-on : ubuntu-latest
155179 strategy :
156180 matrix :
157181 node_version_to_setup : [12, 14, 16, 17]
182+ permissions :
183+ contents : read # for actions/checkout
158184 steps :
159185 - name : Checkout repo
160- uses : actions/checkout@v2
186+ uses : actions/checkout@v4
161187 with :
162188 persist-credentials : false
163189
164190 - name : Setup Node.js v${{ matrix.node_version_to_setup }}
165- uses : actions/setup-node@v2
191+ uses : actions/setup-node@v4
166192 with :
167193 cache : npm
168194 node-version : ${{ matrix.node_version_to_setup }}
@@ -173,18 +199,40 @@ jobs:
173199 - name : Run Tests
174200 run : npm run testonly
175201
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+
176222 build-npm-dist :
177223 name : Build 'npmDist' artifact
178224 runs-on : ubuntu-latest
179225 needs : [test, fuzz, lint, integrationTests]
226+ permissions :
227+ contents : read # for actions/checkout
180228 steps :
181229 - name : Checkout repo
182- uses : actions/checkout@v2
230+ uses : actions/checkout@v4
183231 with :
184232 persist-credentials : false
185233
186234 - name : Setup Node.js
187- uses : actions/setup-node@v2
235+ uses : actions/setup-node@v4
188236 with :
189237 cache : npm
190238 node-version-file : ' .node-version'
@@ -196,7 +244,7 @@ jobs:
196244 run : npm run build:npm
197245
198246 - name : Upload npmDist package
199- uses : actions/upload-artifact@v2
247+ uses : actions/upload-artifact@v4
200248 with :
201249 name : npmDist
202250 path : ./npmDist
@@ -205,14 +253,16 @@ jobs:
205253 name : Build 'denoDist' artifact
206254 runs-on : ubuntu-latest
207255 needs : [test, fuzz, lint, integrationTests]
256+ permissions :
257+ contents : read # for actions/checkout
208258 steps :
209259 - name : Checkout repo
210- uses : actions/checkout@v2
260+ uses : actions/checkout@v4
211261 with :
212262 persist-credentials : false
213263
214264 - name : Setup Node.js
215- uses : actions/setup-node@v2
265+ uses : actions/setup-node@v4
216266 with :
217267 cache : npm
218268 node-version-file : ' .node-version'
@@ -224,34 +274,7 @@ jobs:
224274 run : npm run build:deno
225275
226276 - name : Upload denoDist package
227- uses : actions/upload-artifact@v2
277+ uses : actions/upload-artifact@v4
228278 with :
229279 name : denoDist
230280 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