-
Notifications
You must be signed in to change notification settings - Fork 212
412 lines (325 loc) · 10.6 KB
/
test-js-packages.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
name: Javascript Tests
on:
pull_request:
merge_group:
push:
branches:
- master
# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-nargo:
runs-on: ubuntu-22.04
steps:
- name: Checkout Noir repo
uses: actions/checkout@v4
- name: Setup toolchain
uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
key: x86_64-unknown-linux-gnu
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}
- name: Build Nargo
run: cargo build --package nargo_cli --release
- name: Package artifacts
run: |
mkdir dist
cp ./target/release/nargo ./dist/nargo
7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nargo
path: ./dist/*
retention-days: 3
build-noir-wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Nix
uses: ./.github/actions/nix
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache-name: "noir"
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }}
- name: Build wasm package
run: |
nix build -L .#noir_wasm
- name: Dereference symlink
run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: noir_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 3
build-acvm-js:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Nix
uses: ./.github/actions/nix
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache-name: "noir"
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }}
- name: Build acvm-js
run: |
nix build -L .#acvm_js
- name: Dereference symlink
run: echo "UPLOAD_PATH=$(readlink -f result/acvm_js)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: acvm-js
path: ${{ env.UPLOAD_PATH }}
retention-days: 3
build-noirc-abi:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup Nix
uses: ./.github/actions/nix
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache-name: "noir"
cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }}
- name: Build noirc_abi_wasm
run: |
nix build -L .#noirc_abi_wasm
- name: Dereference symlink
run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: noirc_abi_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 10
test-acvm_js-node:
needs: [build-acvm-js]
name: ACVM JS (Node.js)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Set up test environment
uses: ./.github/actions/setup
- name: Run node tests
run: yarn workspace @noir-lang/acvm_js test
test-acvm_js-browser:
needs: [build-acvm-js]
name: ACVM JS (Browser)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Set up test environment
uses: ./.github/actions/setup
- name: Install playwright deps
run: |
npx playwright install
npx playwright install-deps
- name: Run browser tests
run: yarn workspace @noir-lang/acvm_js test:browser
test-noirc-abi:
needs: [build-noirc-abi]
name: noirc_abi
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Run node tests
run: yarn workspace @noir-lang/noirc_abi test
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Run browser tests
run: yarn workspace @noir-lang/noirc_abi test:browser
test-noir-js:
needs: [build-acvm-js, build-noirc-abi]
name: Noir JS
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noir_js_types
run: yarn workspace @noir-lang/types build
- name: Build barretenberg wrapper
run: yarn workspace @noir-lang/backend_barretenberg build
- name: Run noir_js tests
run: |
yarn workspace @noir-lang/noir_js build
yarn workspace @noir-lang/noir_js test
test-source-resolver:
name: source-resolver
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build @noir-lang/source-resolver
run: yarn workspace @noir-lang/source-resolver build
- name: Run tests
run: yarn workspace @noir-lang/source-resolver test
test-noir-wasm:
needs: [build-noir-wasm, build-nargo]
name: noir_wasm
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noir_wasm
path: ./compiler/wasm
- name: Download nargo binary
uses: actions/download-artifact@v3
with:
name: nargo
path: ./nargo
- name: Compile fixtures with Nargo CLI
working-directory: ./compiler/wasm/fixtures
run: |
nargo_binary=${{ github.workspace }}/nargo/nargo
chmod +x $nargo_binary
for dir in $(ls -d */); do
pushd $dir/noir-script
$nargo_binary compile
popd
done
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Install dependencies
run: |
yarn workspace @noir-lang/source-resolver build
- name: Run node tests
run: yarn workspace @noir-lang/noir_wasm test:node
- name: Run browser tests
run: yarn workspace @noir-lang/noir_wasm test:browser
test-noir-codegen:
needs: [build-acvm-js, build-noirc-abi]
name: noir_codegen
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download acvm_js package artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download noirc_abi package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Build noir_js_types
run: yarn workspace @noir-lang/types build
- name: Build noir_js
run: yarn workspace @noir-lang/noir_js build
- name: Run noir_codegen tests
run: yarn workspace @noir-lang/noir_codegen test
test-integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: [build-acvm-js, build-noir-wasm, build-nargo, build-noirc-abi]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download nargo binary
uses: actions/download-artifact@v3
with:
name: nargo
path: ./nargo
- name: Download acvm_js package artifact
uses: actions/download-artifact@v3
with:
name: acvm-js
path: ./acvm-repo/acvm_js
- name: Download noir_wasm package artifact
uses: actions/download-artifact@v3
with:
name: noir_wasm
path: ./compiler/wasm
- name: Download noirc_abi package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm
- name: Set nargo on PATH
run: |
nargo_binary="${{ github.workspace }}/nargo/nargo"
chmod +x $nargo_binary
echo "$(dirname $nargo_binary)" >> $GITHUB_PATH
export PATH="$PATH:$(dirname $nargo_binary)"
nargo -V
- name: Install Yarn dependencies
uses: ./.github/actions/setup
- name: Install Playwright
uses: ./.github/actions/install-playwright
- name: Setup `integration-tests`
run: |
# Note the lack of spaces between package names.
PACKAGES_TO_BUILD="@noir-lang/source-resolver,@noir-lang/types,@noir-lang/backend_barretenberg,@noir-lang/noir_js"
yarn workspaces foreach -vp --from "{$PACKAGES_TO_BUILD}" run build
- name: Run `integration-tests`
run: |
yarn test:integration
# This is a noop job which depends on all test jobs
# This allows us to add/remove test jobs without having to update the required workflows.
tests-end:
name: End
runs-on: ubuntu-latest
needs:
- test-acvm_js-node
- test-acvm_js-browser
- test-noirc-abi
- test-noir-js
- test-source-resolver
- test-noir-wasm
- test-noir-codegen
- test-integration
steps:
- name: Noop
run: echo "noop"