forked from zcash/zcash
-
Notifications
You must be signed in to change notification settings - Fork 0
284 lines (250 loc) · 10.1 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
name: CI
on:
pull_request:
push:
branches: master
jobs:
matrices:
name: Define CI matrix
runs-on: ubuntu-latest
strategy:
matrix:
cfg:
- data:
- name: ubuntu-20.04
tier: 1
platform: Ubuntu 20.04
build_os: ubuntu-20.04-8cores
test_os: ubuntu-20.04
- name: ubuntu-22.04
tier: 3
platform: Ubuntu 22.04
build_os: ubuntu-22.04-8cores
test_os: ubuntu-22.04
- name: macos-11
tier: 3
platform: macOS Big Sur 11
build_os: macos-11
test_os: macos-11
brew_deps: >
autoconf
automake
coreutils
libtool
pkgconfig
- name: mingw32
tier: 3
platform: Windows (64-bit MinGW)
build_os: ubuntu-22.04-8cores
test_os: windows-latest
cross_deps: >
mingw-w64
host: 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: HOST=aarch64-linux-gnu
outputs:
build_matrix: ${{ steps.set-matrices.outputs.build_matrix }}
test_matrix: ${{ steps.set-matrices.outputs.test_matrix }}
test_names: ${{ steps.set-matrices.outputs.test_names }}
steps:
- 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[] | select(.test_os)] | @json "test_matrix=\(.)"' >> $GITHUB_OUTPUT
jq -r -n 'env.CFG | fromjson | [.data[] | select(.test_os) | .name] | @json "test_names=\(.)"' >> $GITHUB_OUTPUT
build:
name: Build tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: matrices
runs-on: ${{ matrix.build_os }}
continue-on-error: ${{ matrix.tier == 3 }}
strategy:
matrix:
include: ${{ fromJson(needs.matrices.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@v3
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@v3
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
run: >
${{ matrix.host }}
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
- name: Upload zcashd artifact
uses: actions/upload-artifact@v3
with:
name: zcashd-${{ matrix.name }}
path: |
${{ format('src/zcash-cli{0}', matrix.file_ext) }}
${{ format('src/zcashd{0}', matrix.file_ext) }}
- name: Upload zcash-btest artifact
if: matrix.test_os != ''
uses: actions/upload-artifact@v3
with:
name: zcash-btest-${{ matrix.name }}
path: ${{ format('src/test/test_bitcoin{0}', matrix.file_ext) }}
- name: Upload zcash-gtest artifact
if: matrix.test_os != ''
uses: actions/upload-artifact@v3
with:
name: zcash-gtest-${{ matrix.name }}
path: ${{ format('src/zcash-gtest{0}', matrix.file_ext) }}
bitrot:
name: Bitrot check tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [matrices, build]
runs-on: ${{ matrix.build_os }}
continue-on-error: ${{ matrix.tier == 3 }}
strategy:
matrix:
include: ${{ fromJson(needs.matrices.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@v3
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@v3
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 libraries enabled
run: >
CONFIGURE_FLAGS="--with-libs"
${{ matrix.host }}
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
- name: Build zcashd with wallet disabled
run: >
CONFIGURE_FLAGS="--disable-wallet"
${{ matrix.host }}
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
- name: Build zcashd with mining disabled
run: >
CONFIGURE_FLAGS="--disable-mining"
${{ matrix.host }}
./zcutil/build.sh
-j"${{ steps.nproc.outputs.count }}"
test-btest:
name: Boost.Test tier ${{ matrix.tier }} platform ${{ matrix.platform }}
needs: [matrices, build]
runs-on: ${{ matrix.test_os }}
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
include: ${{ fromJson(needs.matrices.outputs.test_matrix) }}
steps:
- name: Download zcash-btest artifact
uses: actions/download-artifact@v3
with:
name: zcash-btest-${{ matrix.name }}
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ${{ format('./test_bitcoin{0}', matrix.file_ext) }}
- name: Run Boost.Tests
run: ${{ format('./test_bitcoin{0}', matrix.file_ext) }} -p
test-gtest:
name: GoogleTest tier ${{ matrix.tier }} platform ${{ matrix.platform }} - shard ${{ matrix.gtest_shards }}
needs: [matrices, build]
runs-on: ${{ matrix.test_os }}
continue-on-error: ${{ matrix.tier != 1 }}
strategy:
matrix:
name: ${{ fromJson(needs.matrices.outputs.test_names) }}
shard_index: [0, 1]
include: ${{ fromJson(needs.matrices.outputs.test_matrix) }}
steps:
- name: Download zcash-gtest artifact
uses: actions/download-artifact@v3
with:
name: zcash-gtest-${{ matrix.name }}
- name: Make artifact executable
if: runner.os != 'Windows'
run: chmod +x ${{ format('./zcash-gtest{0}', matrix.file_ext) }}
- name: Get environment variables
id: env
shell: bash
run: |
echo "appdata=$APPDATA" >> "$GITHUB_OUTPUT"
echo "home=$HOME" >> "$GITHUB_OUTPUT"
- name: Download Sprout parameters
uses: carlosperate/download-file-action@v2.0.1
with:
file-url: "https://download.z.cash/downloads/sprout-groth16.params"
location: >
${{
runner.os == 'Windows' && steps.env.outputs.appdata || steps.env.outputs.home
}}${{
runner.os == 'macOS' && '/Library/Application Support/' || '/'
}}${{
runner.os == 'Linux' && '.zcash-params' || 'ZcashParams'
}}
- name: Run GoogleTests
env:
GTEST_TOTAL_SHARDS: 2
GTEST_SHARD_INDEX: ${{ matrix.shard_index }}
run: ${{ format('./zcash-gtest{0}', matrix.file_ext) }}