-
Notifications
You must be signed in to change notification settings - Fork 956
561 lines (540 loc) · 20.9 KB
/
build-and-test.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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
name: Build and Test
on:
push:
branches:
- main
- "!eth-bridge-integration"
# Run in PRs with conflicts (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request)
pull_request_target:
branches:
- main
- "!eth-bridge-integration"
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
packages: read
env:
GIT_LFS_SKIP_SMUDGE: 1
jobs:
build-wasm:
timeout-minutes: 30
runs-on:
group: gians-runners
container:
image: ghcr.io/anoma/namada:wasm-main
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
wasm_cache_version: ["v2"]
mold_version: [1.11.0]
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# From https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target:
# "This event runs in the context of the base of the pull request,
# rather than in the context of the merge commit, as the pull_request
# event does."
# We set the ref to the head commit of the PR instead.
# For this, we have to make sure that we're not running CI on untrusted
# code (more info in the link above), so the repo MUST be configured
# to disallow that.
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build WASM
run: |
make build-wasm-scripts
- name: Upload wasm artifacts
uses: actions/upload-artifact@v3
with:
name: wasm-${{ github.event.pull_request.head.sha || github.sha }}
path: |
wasm/tx_*.wasm
wasm/vp_*.wasm
wasm/checksums.json
test-wasm:
timeout-minutes: 30
runs-on:
group: gians-runners
needs: [build-wasm]
container:
image: ghcr.io/anoma/namada:wasm-main
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
wasm_cache_version: ["v2"]
nightly_version: [nightly-2023-06-01]
mold_version: [1.11.0]
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Duplicate checksums file
run: cp wasm/checksums.json wasm/original-checksums.json
- name: Install mold linker
run: |
wget -q -O- https://github.com/rui314/mold/releases/download/v${{ matrix.mold_version }}/mold-${{ matrix.mold_version }}-x86_64-linux.tar.gz | tar -xz
mv mold-${{ matrix.mold_version }}-x86_64-linux/bin/mold /usr/local/bin
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.event.pull_request.head.sha|| github.sha }}
path: ./wasm
env:
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Test Wasm
run: make test-wasm
- name: Check wasm up-to-date
run: cmp -- wasm/checksums.json wasm/original-checksums.json
- name: Print diff
if: failure()
run: diff -y -W 150 wasm/checksums.json wasm/original-checksums.json --suppress-common-lines
update-wasm:
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build-wasm.result == 'success' }}
timeout-minutes: 30
needs: [build-wasm]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.event.pull_request.head.sha || github.sha }}
path: ./wasm
- name: Update WASM
run: aws s3 sync wasm s3://$BUCKET_NAME --acl public-read --exclude "*" --include "*.wasm" --exclude "*/*" --region $AWS_REGION
env:
BUCKET_NAME: namada-wasm-master
AWS_REGION: eu-west-1
namada:
runs-on:
group: gians-runners
timeout-minutes: 80
needs: [build-wasm]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
nightly_version: [nightly-2023-06-01]
mold_version: [1.11.0]
make:
- name: ABCI
suffix: ''
cache_key: namada
cache_version: v2
tendermint_artifact: tendermint-unreleased-v0.1.4-abciplus
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Remove some unused data in github runners
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install sccache (ubuntu-20.04)
if: matrix.os == 'ubuntu-20.04'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-
- name: Start sccache server
run: sccache --start-server
- name: Install mold linker
run: |
wget -q -O- https://github.com/rui314/mold/releases/download/v${{ matrix.mold_version }}/mold-${{ matrix.mold_version }}-x86_64-linux.tar.gz | tar -xz
mv mold-${{ matrix.mold_version }}-x86_64-linux/bin/mold /usr/local/bin
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.event.pull_request.head.sha|| github.sha }}
path: ./wasm
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Check crates build with default features
run: make check-crates
- name: Run unit test
run: make test-unit-coverage${{ matrix.make.suffix }}
env:
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage${{ matrix.make.suffix }}-${{ github.event.pull_request.head.sha || github.sha }}
path: target/html
retention-days: 3
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
namada-release:
runs-on:
group: gians-runners
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
mold_version: [1.11.0]
make:
- name: ABCI Release build
suffix: ''
cache_key: namada-e2e-release
cache_version: "v2"
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Remove some unused data in github runners
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install sccache (ubuntu-20.04)
if: matrix.os == 'ubuntu-20.04'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-
- name: Install mold linker
run: |
wget -q -O- https://github.com/rui314/mold/releases/download/v${{ matrix.mold_version }}/mold-${{ matrix.mold_version }}-x86_64-linux.tar.gz | tar -xz
mv mold-${{ matrix.mold_version }}-x86_64-linux/bin/mold /usr/local/bin
- name: Start sccache server
run: sccache --start-server
- name: Build
run: make build-release${{ matrix.make.suffix }}
env:
RUSTFLAGS: "-C linker=clang -C debug_assertions=true -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Upload target binaries
uses: actions/upload-artifact@v3
with:
name: binaries${{ matrix.make.suffix }}-${{ github.event.pull_request.head.sha || github.sha }}
path: |
target/release/namada
target/release/namadac
target/release/namadaw
target/release/namadan
- name: Upload build timing report
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: build-timings-${{ github.event.pull_request.head.sha || github.sha }}
path: |
target/cargo-timings/cargo-timing.html
retention-days: 5
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
namada-e2e:
runs-on:
group: gians-runners
# timeout-minutes: 80
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
nightly_version: [nightly-2023-06-01]
mold_version: [1.7.0]
make:
- name: e2e
suffix: ''
index: 0
cache_key: namada
cache_version: v2
tendermint_artifact: tendermint-unreleased-v0.1.4-abciplus
wait_for: namada-release (ubuntu-20.04, 1.11.0, ABCI Release build, namada-e2e-release, v2)
- name: e2e
suffix: ''
index: 1
cache_key: namada
cache_version: v2
tendermint_artifact: tendermint-unreleased-v0.1.4-abciplus
wait_for: namada-release (ubuntu-20.04, 1.11.0, ABCI Release build, namada-e2e-release, v2)
- name: e2e
suffix: ''
index: 2
cache_key: namada
cache_version: v2
tendermint_artifact: tendermint-unreleased-v0.1.4-abciplus
wait_for: namada-release (ubuntu-20.04, 1.11.0, ABCI Release build, namada-e2e-release, v2)
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Remove some unused data in github runners
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install sccache (ubuntu-20.04)
if: matrix.os == 'ubuntu-20.04'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-
- name: Start sccache server
run: sccache --start-server
- name: Install mold linker
run: |
wget -q -O- https://github.com/rui314/mold/releases/download/v${{ matrix.mold_version }}/mold-${{ matrix.mold_version }}-x86_64-linux.tar.gz | tar -xz
mv mold-${{ matrix.mold_version }}-x86_64-linux/bin/mold /usr/local/bin
- name: Build
run: make build
env:
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Build test
run: make build-test
env:
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Wait for release binaries
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
check-name: ${{ matrix.make.wait_for }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 42
allowed-conclusions: success
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.event.pull_request.head.sha|| github.sha }}
path: ./wasm
- name: Download namada binaries
uses: actions/download-artifact@v3
with:
name: binaries${{ matrix.make.suffix }}-${{ github.event.pull_request.head.sha || github.sha }}
path: ./target/release/
- name: Download tendermint & cometbft
run: |
curl -o cometbft.tar.gz -LO https://github.com/cometbft/cometbft/releases/download/v0.37.2/cometbft_0.37.2_linux_amd64.tar.gz
tar -xvzf cometbft.tar.gz
mv cometbft /usr/local/bin
curl -o tendermint.tar.gz -LO https://github.com/heliaxdev/tendermint/releases/download/v0.1.4-abciplus/tendermint_0.1.4-abciplus_linux_amd64.tar.gz
tar -xvzf tendermint.tar.gz
mv tendermint /usr/local/bin
- name: Change permissions
run: |
chmod +x target/release/namada
chmod +x target/release/namadaw
chmod +x target/release/namadan
chmod +x target/release/namadac
chmod +x /usr/local/bin/tendermint
chmod +x /usr/local/bin/cometbft
- name: Run e2e test
run: |
mkdir -p /home/runner/work/masp-params
curl -o /home/runner/work/masp-params/masp-spend.params -LO https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params?raw=true
curl -o /home/runner/work/masp-params/masp-output.params -LO https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true
curl -o /home/runner/work/masp-params/masp-convert.params -LO https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true
ls -l /home/runner/work/masp-params
shasum /home/runner/work/masp-params/*.params
python3 .github/workflows/scripts/schedule-e2e.py
env:
NAMADA_TENDERMINT_WEBSOCKET_TIMEOUT: 20
NAMADA_E2E_USE_PREBUILT_BINARIES: "true"
NAMADA_E2E_KEEP_TEMP: "true"
NAMADA_TM_STDOUT: "false"
NAMADA_LOG_COLOR: "false"
# NAMADA_MASP_PARAMS_DIR: "/home/runner/work/masp-params"
NAMADA_LOG: "info"
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold"
INDEX: ${{ matrix.make.index }}
- name: Upload e2e logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: logs-e2e-${{ matrix.make.index }}-${{ github.event.pull_request.head.sha || github.sha }}
path: |
/tmp/.*/logs/
/tmp/.*/e2e-test.*/setup/validator-*/.namada/logs/*.log
retention-days: 5
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true