forked from zcash/zcash
-
Notifications
You must be signed in to change notification settings - Fork 18
797 lines (696 loc) · 28 KB
/
ci.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
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
name: CI
on:
pull_request:
# Any update here needs to be done for `push` (see below), and mirrored into
# `no-ci.yml`.
paths-ignore:
# Workflows that have no effect on this workflow.
- '.github/dependabot.yml'
- '.github/workflows/audits.yml'
- '.github/workflows/book.yml'
- '.github/workflows/ci-skip.yml'
- '.github/workflows/lints.yml'
- '.github/workflows/release-docker-hub.yml'
# Documentation.
- 'contrib/debian/copyright'
- 'doc/**'
- '**.md'
- 'COPYING'
- 'INSTALL'
push:
branches: master
# Any update here needs to be done for `pull_request` (see above), and
# mirrored into `no-ci.yml`.
paths-ignore:
# Workflows that have no effect on this workflow.
- '.github/dependabot.yml'
- '.github/workflows/audits.yml'
- '.github/workflows/book.yml'
- '.github/workflows/ci-skip.yml'
- '.github/workflows/lints.yml'
- '.github/workflows/release-docker-hub.yml'
# Documentation.
- 'contrib/debian/copyright'
- 'doc/**'
- '**.md'
- 'COPYING'
- 'INSTALL'
permissions:
contents: read
jobs:
setup:
name: Define CI matrix
runs-on: ubuntu-latest
strategy:
matrix:
cfg:
- data:
- name: Debian-bookworm
tier: 1
platform: Debian Bookworm
build_os: ubuntu-20.04-8cores
test_os: ubuntu-20.04
container: electriccoinco/debian-helper:bookworm
host: x86_64-pc-linux-gnu
- name: Debian-bullseye
tier: 1
platform: Debian bullseye
build_os: ubuntu-20.04-8cores
test_os: ubuntu-20.04
container: electriccoinco/debian-helper:bullseye
host: x86_64-pc-linux-gnu
- name: ubuntu-20.04
tier: 1
platform: Ubuntu 20.04
build_os: ubuntu-20.04-8cores
test_os: ubuntu-20.04
host: x86_64-pc-linux-gnu
- name: ubuntu-22.04
tier: 3
platform: Ubuntu 22.04
build_os: ubuntu-22.04-8cores
test_os: ubuntu-22.04
host: x86_64-pc-linux-gnu
# - name: macos-12
# tier: 3
# platform: macOS 12 Monterey
# build_os: macos-12
# test_os: macos-12
# brew_deps: >
# autoconf
# automake
# coreutils
# libtool
# pkgconfig
# host: x86_64-apple-darwin
- name: mingw32
tier: 3
platform: Windows (64-bit MinGW)
build_os: ubuntu-22.04-8cores
test_os: windows-latest
cross_deps: >
mingw-w64
host: x86_64-w64-mingw32
file_ext: ".exe"
- name: aarch64-linux
tier: 3
platform: ARM64 Linux
build_os: ubuntu-22.04-8cores
cross_deps: >
g++-aarch64-linux-gnu
host: aarch64-linux-gnu
outputs:
build_matrix: ${{ steps.set-matrices.outputs.build_matrix }}
build_names: ${{ steps.set-matrices.outputs.build_names }}
test_matrix: ${{ steps.set-matrices.outputs.test_matrix }}
test_names: ${{ steps.set-matrices.outputs.test_names }}
unix_test_matrix: ${{ steps.set-matrices.outputs.unix_test_matrix }}
unix_test_names: ${{ steps.set-matrices.outputs.unix_test_names }}
rpc_test_matrix: ${{ steps.set-matrices.outputs.rpc_test_matrix }}
rpc_test_names: ${{ steps.set-matrices.outputs.rpc_test_names }}
rpc_test_shards: ${{ steps.set-rpc-tests.outputs.rpc_test_shards }}
rpc_test_shards_matrix: ${{ steps.set-rpc-tests.outputs.rpc_test_shards_matrix }}
steps:
- uses: actions/checkout@v4
# Configure the build and test matrices. Notes:
# - The `*_names` lists of platforms are combined with job-specific lists to build
# strategy matrices. The `*_matrix` lists then augment the matrix with parameters
# for each platform.
# - We can only run tests on the subset of platforms that have a compatible runner
# (i.e. excluding cross-compiled platforms).
# - Some tests don't currently work on Windows platforms, so we have a Unix subset.
# - We only run RPC tests on Tier 1 platforms, to save costs.
- id: set-matrices
env:
CFG: ${{ toJSON(matrix.cfg) }}
run: |
jq -r -n 'env.CFG | fromjson | @json "build_matrix=\(.data)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | .name] | @json "build_names=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os)] | @json "test_matrix=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os) | .name] | @json "test_names=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os and .test_os != "windows-latest")] | @json "unix_test_matrix=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os and .test_os != "windows-latest") | .name] | @json "unix_test_names=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os and .tier == 1)] | @json "rpc_test_matrix=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os and .tier == 1) | .name] | @json "rpc_test_names=\(.)"' >> $GITHUB_OUTPUT
- id: set-rpc-tests
run: |
cat <<EOF > ./subclass.py
import importlib
import json
import os
import sys
sys.path.append('qa/pull-tester')
rpc_tests = importlib.import_module('rpc-tests')
src_dir = os.environ["SRC_DIR"]
SHARDS = 10
# These tests are ordered longest-test-first, to favor running tests in
# parallel with the regular test runner. For chunking purposes, assign
# tests to shards in round-robin order.
test_shards = {}
for i, test in enumerate(rpc_tests.BASE_SCRIPTS + rpc_tests.ZMQ_SCRIPTS):
test_shards.setdefault(i % SHARDS, []).append(test)
test_list = []
for i, tests in test_shards.items():
test_list.append({
'shard': 'shard-%d' % i,
'rpc_tests': tests,
})
# These tests involve enough shielded spends (consuming all CPU cores)
# that we can't run them in parallel, or fail intermittently so we run
# them separately to enable not requiring that they pass.
for test in rpc_tests.SERIAL_SCRIPTS + rpc_tests.FLAKY_SCRIPTS:
test_list.append({
'shard': test,
'rpc_tests': [test],
})
print(json.dumps(test_list))
EOF
RPC_MATRIX_JSON=$(echo '${{ steps.set-matrices.outputs.rpc_test_matrix }}')
RPC_SHARDS_JSON=$(SRC_DIR=$(pwd) python3 ./subclass.py)
echo "$RPC_SHARDS_JSON" | jq -r '[.[] | .shard] | @json "rpc_test_shards=\(.)"' >> $GITHUB_OUTPUT
echo -e "$RPC_MATRIX_JSON\n$RPC_SHARDS_JSON" | jq -r -s 'add | @json "rpc_test_shards_matrix=\(.)"' >> $GITHUB_OUTPUT
- name: Cache Sprout parameters
uses: actions/cache@v4
with:
path: zcash-params
key: zcash-params
restore-keys: |
zcash-params
- name: Download Sprout parameters
# In case the Sprout parameters are not currently cached
shell: bash
run: |
mkdir zcash-params || echo ""
curl -L -C - https://download.z.cash/downloads/sprout-groth16.params -o zcash-params/sprout-groth16.params
build:
name: Build tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: setup
runs-on: ${{ matrix.build_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier == 3 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.build_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Install Homebrew build dependencies
if: matrix.brew_deps != ''
run: brew install ${{ matrix.brew_deps }}
- name: Install cross-compilation build dependencies
if: matrix.cross_deps != ''
run: sudo apt update && sudo apt install ${{ matrix.cross_deps }}
- name: Configure MinGW to use POSIX variant
if: matrix.name == 'mingw32'
run: |
sudo update-alternatives --set x86_64-w64-mingw32-gcc $(update-alternatives --query x86_64-w64-mingw32-gcc | grep Alternative | grep posix | cut -d' ' -f2)
sudo update-alternatives --set x86_64-w64-mingw32-g++ $(update-alternatives --query x86_64-w64-mingw32-g++ | grep Alternative | grep posix | cut -d' ' -f2)
- name: Cache built dependencies
uses: actions/cache@v4
with:
path: depends/built
key: ${{ matrix.name }}-built-${{ hashFiles('depends/Makefile', 'depends/funcs.mk') }}-${{ hashFiles('depends/packages/*.mk', 'depends/patches/**/*') }}
restore-keys: |
${{ matrix.name }}-built-${{ hashFiles('depends/Makefile', 'depends/funcs.mk') }}-
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: bash
run: echo "timestamp=$(date +'%Y-%m-%d-%H;%M;%S')" >> "$GITHUB_OUTPUT"
- name: Cache ccache files
uses: actions/cache@v4
with:
path: ${{ runner.os == 'macOS' && '~/Library/Caches/ccache' || '~/.cache/ccache' }}
key: ${{ matrix.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.name }}-ccache-
- name: Get the number of available processing cores
id: nproc
shell: bash
run: echo "count=$(nproc 2> /dev/null || sysctl -n hw.logicalcpu)" >> "$GITHUB_OUTPUT"
- name: Build zcashd
id: build
env:
HOST: ${{ matrix.host }}
run: >
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
- name: Upload zcashd and related executables (src)
uses: actions/upload-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: |
${{ format('./src/zcashd{0}', matrix.file_ext) }}
${{ format('./src/zcash-cli{0}', matrix.file_ext) }}
${{ format('./src/zcashd-wallet-tool{0}', matrix.file_ext) }}
${{ format('./src/zcash-tx{0}', matrix.file_ext) }}
${{ format('./src/test/test_bitcoin{0}', matrix.file_ext) }}
${{ format('./src/zcash-gtest{0}', matrix.file_ext) }}
./src/test/buildenv.py
${{ format('./src/bench/bench_bitcoin{0}', matrix.file_ext) }}
- name: Upload src/secp256k1
uses: actions/upload-artifact@v4
with:
name: secp256k1-${{ matrix.name }}
path: ./src/secp256k1
- name: Upload src/univalue
uses: actions/upload-artifact@v4
with:
name: univalue-${{ matrix.name }}
path: ./src/univalue
- name: Upload depends/${{ matrix.host }}/native/bin as depends-native-bin artifact
uses: actions/upload-artifact@v4
with:
name: depends-native-bin-${{ matrix.name }}
path: ./depends/${{ matrix.host }}/native/bin
- name: Upload depends/${{ matrix.host }}/lib as depends-lib artifact
uses: actions/upload-artifact@v4
with:
name: depends-lib-${{ matrix.name }}
path: ./depends/${{ matrix.host }}/lib
bitrot:
name: Bitrot check tier ${{ matrix.tier }} platform ${{ matrix.platform }} flag '${{ matrix.configure_flag }}'
needs: [setup, build]
runs-on: ${{ matrix.build_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier == 3 }}
strategy:
matrix:
name: ${{ fromJson(needs.setup.outputs.build_names) }}
configure_flag:
- '--with-libs'
- '--disable-wallet'
- '--disable-mining'
include: ${{ fromJson(needs.setup.outputs.build_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Install Homebrew build dependencies
if: matrix.brew_deps != ''
run: brew install ${{ matrix.brew_deps }}
- name: Install cross-compilation build dependencies
if: matrix.cross_deps != ''
run: sudo apt update && sudo apt install ${{ matrix.cross_deps }}
- name: Configure MinGW to use POSIX variant
if: matrix.name == 'mingw32'
run: |
sudo update-alternatives --set x86_64-w64-mingw32-gcc $(update-alternatives --query x86_64-w64-mingw32-gcc | grep Alternative | grep posix | cut -d' ' -f2)
sudo update-alternatives --set x86_64-w64-mingw32-g++ $(update-alternatives --query x86_64-w64-mingw32-g++ | grep Alternative | grep posix | cut -d' ' -f2)
- name: Cache built dependencies
uses: actions/cache@v4
with:
path: depends/built
key: ${{ matrix.name }}-built-${{ hashFiles('depends/Makefile', 'depends/funcs.mk') }}-${{ hashFiles('depends/packages/*.mk', 'depends/patches/**/*') }}
restore-keys: |
${{ matrix.name }}-built-${{ hashFiles('depends/Makefile', 'depends/funcs.mk') }}-
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: bash
run: echo "timestamp=$(date +'%Y-%m-%d-%H;%M;%S')" >> "$GITHUB_OUTPUT"
- name: Cache ccache files
uses: actions/cache@v4
with:
path: ${{ runner.os == 'macOS' && '~/Library/Caches/ccache' || '~/.cache/ccache' }}
key: ${{ matrix.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.name }}-ccache-
- name: Get the number of available processing cores
id: nproc
shell: bash
run: echo "count=$(nproc 2> /dev/null || sysctl -n hw.logicalcpu)" >> "$GITHUB_OUTPUT"
- name: Build zcashd with the flag being checked
env:
CONFIGURE_FLAGS: "${{ matrix.configure_flag }}"
HOST: ${{ matrix.host }}
run: >
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
test-btest:
name: Boost.Test tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download src artifact
uses: actions/download-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: ./src
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ${{ format('./src/test/test_bitcoin{0}', matrix.file_ext) }}
- name: Run Boost.Tests
run: ${{ format('./src/test/test_bitcoin{0}', matrix.file_ext) }} -p
test-gtest:
name: GoogleTest tier ${{ matrix.tier }} platform ${{ matrix.platform }} - shard ${{ matrix.shard_index }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
name: ${{ fromJson(needs.setup.outputs.test_names) }}
shard_index: [0, 1]
include: ${{ fromJson(needs.setup.outputs.test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download src artifact
uses: actions/download-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: ./src
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ${{ format('./src/zcash-gtest{0}', matrix.file_ext) }}
- name: Cache Sprout parameters
uses: actions/cache@v4
with:
path: zcash-params
key: zcash-params
restore-keys: |
zcash-params
- name: Download Sprout parameters
# In case the cache of Sprout parameters step fails
shell: bash
run: |
mkdir zcash-params || echo ""
curl -L -C - https://download.z.cash/downloads/sprout-groth16.params -o zcash-params/sprout-groth16.params
- name: Setup zcash-params
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
mv zcash-params "$APPDATA/ZcashParams"
elif [ "${{ runner.os }}" == "macOS" ]; then
mv zcash-params "$HOME/Library/Application Support/ZcashParams"
elif [ "${{ runner.os }}" == "Linux" ]; then
mv zcash-params "$HOME/.zcash-params"
fi
- name: Run GoogleTests
env:
GTEST_TOTAL_SHARDS: 2
GTEST_SHARD_INDEX: ${{ matrix.shard_index }}
run: ${{ format('./src/zcash-gtest{0}', matrix.file_ext) }}
test-rust:
name: Rust test tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Run Rust tests
run: cargo test
# Not designed for Windows
test-secp256k1:
name: secp256k1 tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.unix_test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Install Homebrew build dependencies
if: matrix.brew_deps != ''
run: brew install ${{ matrix.brew_deps }}
- name: Download src/secp256k1 artifact
uses: actions/download-artifact@v4
with:
name: secp256k1-${{ matrix.name }}
path: ./src/secp256k1
- name: Run secp256k1 test
shell: bash
run: python3 ./qa/zcash/full_test_suite.py secp256k1
env:
HOST: ${{ matrix.host }}
# Not designed for Windows
test-univalue:
name: univalue tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.unix_test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Install Homebrew build dependencies
if: matrix.brew_deps != ''
run: brew install ${{ matrix.brew_deps }}
- name: Download native/bin artifact
uses: actions/download-artifact@v4
with:
name: depends-native-bin-${{ matrix.name }}
path: ./depends/${{ matrix.host }}/
- name: Download src/univalue artifact
uses: actions/download-artifact@v4
with:
name: univalue-${{ matrix.name }}
path: ./src/univalue
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ./src/univalue/build-aux/install-sh
- name: Run univalue test
shell: bash
run: python3 ./qa/zcash/full_test_suite.py univalue
env:
HOST: ${{ matrix.host }}
# Not designed for Windows
test-util:
name: util-test tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.unix_test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download src artifact
uses: actions/download-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: ./src
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ${{ format('./src/zcash-tx{0}', matrix.file_ext) }}
- name: Run util-test test
shell: bash
run: python3 ./qa/zcash/full_test_suite.py util-test
env:
HOST: ${{ matrix.host }}
no-dot-so:
name: no-dot-so tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download depends/${{ matrix.host }}/lib
uses: actions/download-artifact@v4
with:
name: depends-lib-${{ matrix.name }}
path: ./depends/${{ matrix.host }}/lib
- name: Run no-dot-so test
run: python3 ./qa/zcash/full_test_suite.py no-dot-so
env:
HOST: ${{ matrix.host }}
# Not working in Windows
sec-hard:
name: sec-hard tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [setup, build]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.setup.outputs.unix_test_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download src artifact
uses: actions/download-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: ./src
- name: Make artifact executable
if: runner.os != 'Windows'
run: |
chmod +x ${{ format('./src/test/test_bitcoin{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/bench/bench_bitcoin{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcashd{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcash-cli{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcash-gtest{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcashd-wallet-tool{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcash-tx{0}', matrix.file_ext) }}
- name: Run sec-hard test
shell: bash
run: python3 ./qa/zcash/full_test_suite.py sec-hard
env:
HOST: ${{ matrix.host }}
rpc-depends:
name: RPC set up tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: setup
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
name: ${{ fromJson(needs.setup.outputs.rpc_test_names) }}
include: ${{ fromJson(needs.setup.outputs.rpc_test_matrix) }}
steps:
- name: Cache Python dependencies for RPC tests
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: venv
key: test-rpc-venv-${{ matrix.name }}
- name: Get Python dependencies for RPC tests
run: |
python3 -m venv ./venv
. ./venv/bin/activate
pip install zmq asyncio base58
test-rpc:
name: RPC tests tier ${{ matrix.tier }} platform ${{ matrix.platform }} ${{ matrix.shard }}
needs: [setup, build, rpc-depends]
runs-on: ${{ matrix.test_os }}
container:
image: ${{ matrix.container }}
env:
HOME: /root
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
fail-fast: false
matrix:
name: ${{ fromJson(needs.setup.outputs.rpc_test_names) }}
shard : ${{ fromJson(needs.setup.outputs.rpc_test_shards) }}
include: ${{ fromJson(needs.setup.outputs.rpc_test_shards_matrix) }}
steps:
- uses: actions/checkout@v4
- name: Cache Python dependencies for RPC tests
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: venv
key: test-rpc-venv-${{ matrix.name }}
- name: Get Python dependencies for RPC tests if not cached
run: |
python3 -m venv ./venv
. ./venv/bin/activate
pip install zmq asyncio base58
- name: Download src artifact
uses: actions/download-artifact@v4
with:
name: zcashd-${{ matrix.name }}
path: ./src
- name: Make artifact executable
if: runner.os != 'Windows'
run: |
chmod +x ${{ format('./src/zcashd{0}', matrix.file_ext) }}
chmod +x ${{ format('./src/zcash-cli{0}', matrix.file_ext) }}
- name: Get Sprout parameters
uses: actions/cache@v4
with:
path: zcash-params
key: zcash-params
restore-keys: |
zcash-params
- name: Download Sprout parameters
# In case the cache of Sprout parameters step fails
shell: bash
run: |
mkdir zcash-params || echo ""
curl -L -C - https://download.z.cash/downloads/sprout-groth16.params -o zcash-params/sprout-groth16.params
- name: Setup zcash-params
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
mv zcash-params "$APPDATA/ZcashParams"
elif [ "${{ runner.os }}" == "macOS" ]; then
mv zcash-params "$HOME/Library/Application Support/ZcashParams"
elif [ "${{ runner.os }}" == "Linux" ]; then
mv zcash-params "$HOME/.zcash-params"
fi
- name: RPC test ${{ matrix.shard }}
run: |
cat <<EOF > ./subclass.py
import importlib
import os
import subprocess
import sys
sys.path.append('qa/pull-tester')
rpc_tests = importlib.import_module('rpc-tests')
src_dir = os.environ["SRC_DIR"]
build_dir = '.'
exeext = '${{ matrix.file_ext }}'
class MyTestHandler(rpc_tests.RPCTestHandler):
def start_test(self, args, stdout, stderr):
return subprocess.Popen(
args,
universal_newlines=True,
stdout=stdout,
stderr=stderr)
test_list = ${{ toJSON(matrix.rpc_tests) }}
all_passed = rpc_tests.run_tests(MyTestHandler, test_list, src_dir, build_dir, exeext, jobs=len(test_list))
if all_passed == False:
sys.exit(1)
EOF
. ./venv/bin/activate
ZCASHD=$(pwd)/${{ format('src/zcashd{0}', matrix.file_ext) }} SRC_DIR=$(pwd) python3 ./subclass.py