-
Notifications
You must be signed in to change notification settings - Fork 35
293 lines (240 loc) · 10.3 KB
/
Copy pathbuild.yml
File metadata and controls
293 lines (240 loc) · 10.3 KB
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
name: build
on:
push:
branches:
- master
pull_request:
branches:
- "**" # target all branches
schedule:
- cron: '15 0 * * *' # every day at 00:15 UTC
env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
RUST_BACKTRACE: full
jobs:
build_windows:
runs-on: windows-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: './build-tools/.python-version'
- name: Install Rust
# Use bash to be able to escape the newline via '\'.
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain $(python ./build-tools/cargo-info-extractor/extract.py --rust-version)
- name: Build
run: cargo build --release --locked --features trezor
- name: Run tests
run: cargo test --release --workspace --features trezor
- name: Run doc tests
run: cargo test --release --doc --features trezor
# This test is ignored, so it needs to run separately.
- name: Run mixed_sighash_types test
run: cargo test --release mixed_sighash_types --features trezor
# This test is ignored, so it needs to run separately.
- name: Run test_4opc_sequences test
run: cargo test --release test_4opc_sequences -- --ignored
- name: Run functional tests
run: cargo test --release -p mintlayer-test --test functional -- --ignored
- uses: actions/upload-artifact@v4
if: failure()
with:
name: windows-functional-test-artifacts
path: target/tmp
build_ubuntu:
env:
ML_CONTAINERIZED_TESTS: 1
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Update the list of available system packages
run: sudo apt-get update
- name: Install build dependencies
run: sudo apt-get install -yqq --no-install-recommends build-essential podman pkg-config libssl-dev
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: './build-tools/.python-version'
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain $(python ./build-tools/cargo-info-extractor/extract.py --rust-version)
- name: Build
run: cargo build --release --locked --features trezor
- name: Run tests
run: cargo test --release --workspace --features trezor
- name: Run doc tests
run: cargo test --release --doc --features trezor
# This test is ignored, so it needs to run separately.
- name: Run mixed_sighash_types test
run: cargo test --release mixed_sighash_types --features trezor
# This test is ignored, so it needs to run separately.
- name: Run test_4opc_sequences test
run: cargo test --release test_4opc_sequences
- name: Run functional tests
run: cargo test --release -p mintlayer-test --test functional -- --ignored
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ubuntu-functional-test-artifacts
path: target/tmp
build_macos:
runs-on: macos-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: './build-tools/.python-version'
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain $(python ./build-tools/cargo-info-extractor/extract.py --rust-version)
- name: Build
run: cargo build --release --locked --features trezor
- name: Run tests
run: cargo test --release --workspace --features trezor
- name: Run doc tests
run: cargo test --release --doc --features trezor
# This test is ignored, so it needs to run separately.
- name: Run mixed_sighash_types test
run: cargo test --release mixed_sighash_types --features trezor
# This test is ignored, so it needs to run separately.
- name: Run test_4opc_sequences test
run: cargo test --release test_4opc_sequences
- name: Run functional tests
run: cargo test --release -p mintlayer-test --test functional -- --ignored
- uses: actions/upload-artifact@v4
if: failure()
with:
name: macos-functional-test-artifacts
path: target/tmp
# Build Trezor-specific tests and archive them using cargo-nextest's "archive" feature.
run_tests_on_trezor_preparation:
runs-on: ubuntu-latest
steps:
# Note: we need to mimic the directory structure of the run_tests_on_trezor job, otherwise nextest
# will fail to execute archived tests. So we checkout the source code to "./mintlayer-core".
# (Also note that because of this the resulting path of the source dir will be "/.../mintlayer-core/mintlayer-core/mintlayer-core")
- name: Checkout the core repository
uses: actions/checkout@v5
with:
submodules: recursive
path: ./mintlayer-core
- name: Update the list of available system packages
run: sudo apt-get update
- name: Install build dependencies
run: sudo apt-get install -yqq --no-install-recommends build-essential pkg-config libssl-dev
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: './mintlayer-core/build-tools/.python-version'
- name: Extract required info from Cargo.toml
id: extract_cargo_info
run: echo "RUST_VERSION=$(python ./build-tools/cargo-info-extractor/extract.py --rust-version)" >> $GITHUB_OUTPUT
working-directory: ./mintlayer-core
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain ${{ steps.extract_cargo_info.outputs.RUST_VERSION }}
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Build and archive the tests
run: cargo nextest archive --release --locked -p wallet --features enable-trezor-device-tests --archive-file tests.tar.zst
working-directory: ./mintlayer-core
- name: Upload archived tests
uses: actions/upload-artifact@v4
with:
name: archived-trezor-tests
path: ./mintlayer-core/tests.tar.zst
retention-days: 1
run_tests_on_trezor:
needs: run_tests_on_trezor_preparation
runs-on: ubuntu-latest
strategy:
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
env:
TREZOR_MODEL: ${{ matrix.model }}
# Note: these are the default values, but it's better to specify them explicitly.
TREZOR_TESTS_USE_REAL_DEVICE: false
TREZOR_TESTS_AUTO_CONFIRM: true
steps:
# Note: cargo-nextest requires the source code to be present when running archived test binaries.
- name: Checkout the core repository
uses: actions/checkout@v5
with:
submodules: recursive
path: ./mintlayer-core
- name: Download archived tests
uses: actions/download-artifact@v4
with:
name: archived-trezor-tests
path: ./mintlayer-core
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Update the list of available system packages
run: sudo apt-get update
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: './mintlayer-core/build-tools/.python-version'
- name: Extract required info from Cargo.toml
id: extract_cargo_info
run: |
echo "TREZOR_REPO_REV=$(python ./build-tools/cargo-info-extractor/extract.py --trezor-repo-rev)" >> $GITHUB_OUTPUT
working-directory: ./mintlayer-core
- name: Checkout mintlayer-trezor-firmware repository
uses: actions/checkout@v5
with:
repository: mintlayer/mintlayer-trezor-firmware
ref: ${{ steps.extract_cargo_info.outputs.TREZOR_REPO_REV }}
submodules: recursive
path: ./mintlayer-trezor-firmware
# Note: this is basically a copy of ".github/actions/environment" from the trezor repo, with
# the "full-deps" parameter equal to false (which is the default).
# Also note that the original "environment" action could technically be called from here
# via "uses", so in theory the duplication could be avoided. Unfortunately, the "nix-shell"
# calls require the current directory to be the one where the trezor repo has been checked out
# and there is no way of overriding the working dir for another action (unless the action itself
# supports it).
- name: Install nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Setup trezor repo build dependencies, part 1
run: nix-shell --arg fullDeps false --run "true"
working-directory: ./mintlayer-trezor-firmware
- name: Setup trezor repo build dependencies, part 2
run: nix-shell --arg fullDeps false --run "poetry install"
working-directory: ./mintlayer-trezor-firmware
- name: Build the firmware
run: nix-shell --run "poetry run make -C core build_unix"
working-directory: ./mintlayer-trezor-firmware
# Note: since we haven't installed Cargo in this job, we have to execute "cargo-nextest nextest"
# instead of "cargo nextest".
- name: Run tests in the emulator
run:
nix-shell --run "
poetry run core/emu.py
--headless --quiet --temporary-profile
--mnemonic \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\"
--command env --chdir ../mintlayer-core
cargo-nextest nextest run --archive-file tests.tar.zst -j1 trezor_signer
"
working-directory: ./mintlayer-trezor-firmware
timeout-minutes: 10