@@ -30,25 +30,44 @@ jobs:
30
30
- run : make cpp_test
31
31
32
32
build_ledger :
33
- needs : configure
33
+ needs : [ configure, setup_rust]
34
34
runs-on : ubuntu-latest
35
35
container :
36
36
image : zondax/ledger-app-builder:latest
37
- options : --user ${{ needs.configure.outputs.uid_gid }}
37
+ options : --user root
38
38
env :
39
39
BOLOS_SDK : /opt/nanos-secure-sdk
40
+ HOME : /root
41
+ CARGO_HOME : ${{ needs.setup_rust.outputs.cargo_home }}
42
+ RUSTUP_HOME : ${{ needs.setup_rust.outputs.rustup_home }}
43
+ PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ needs.setup_rust.outputs.cargo_home }}/bin
40
44
outputs :
41
45
size : ${{steps.build.outputs.size}}
42
46
steps :
43
47
- name : Checkout
44
48
uses : actions/checkout@v4
45
49
with :
46
- submodules : true
50
+ submodules : recursive
51
+ - name : Setup Rust environment
52
+ uses : actions-rs/toolchain@v1
53
+ with :
54
+ toolchain : stable
55
+ target : thumbv6m-none-eabi
56
+ override : true
57
+ - name : Cache Rust dependencies
58
+ uses : actions/cache@v3
59
+ with :
60
+ path : |
61
+ ${{ needs.setup_rust.outputs.cargo_home }}
62
+ target/
63
+ key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
64
+ restore-keys : |
65
+ ${{ runner.os }}-rust-
47
66
- name : Build Standard app
48
67
id : build
49
68
shell : bash -l {0}
50
69
run : |
51
- make
70
+ make
52
71
echo "size=$(python3 deps/ledger-zxlib/scripts/getSize.py s)" >> $GITHUB_OUTPUT
53
72
54
73
clippy :
@@ -92,6 +111,17 @@ jobs:
92
111
run : cd ./app/rust
93
112
cargo test
94
113
114
+ setup_rust :
115
+ runs-on : ubuntu-latest
116
+ outputs :
117
+ cargo_home : ${{ steps.set_paths.outputs.cargo_home }}
118
+ rustup_home : ${{ steps.set_paths.outputs.rustup_home }}
119
+ steps :
120
+ - id : set_paths
121
+ run : |
122
+ echo "cargo_home=$GITHUB_WORKSPACE/app/rust/.cargo" >> $GITHUB_OUTPUT
123
+ echo "rustup_home=$GITHUB_WORKSPACE/app/rust/.rustup" >> $GITHUB_OUTPUT
124
+
95
125
build_application :
96
126
name : Build application using the reusable workflow
97
127
uses : LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
@@ -185,19 +215,39 @@ jobs:
185
215
path : tests_zemu/snapshots-tmp/
186
216
187
217
build_package_nanos :
188
- needs : [configure, build, build_ledger, test_zemu]
218
+ needs : [configure, setup_rust, build, build_ledger, test_zemu]
189
219
if : ${{ github.ref == 'refs/heads/main' }}
190
220
runs-on : ubuntu-latest
191
221
container :
192
222
image : zondax/ledger-app-builder:latest
193
- options : --user ${{ needs.configure.outputs.uid_gid }}
223
+ options : --user root
194
224
env :
195
225
BOLOS_SDK : /opt/nanos-secure-sdk
226
+ HOME : /root
227
+ CARGO_HOME : ${{ needs.setup_rust.outputs.cargo_home }}
228
+ RUSTUP_HOME : ${{ needs.setup_rust.outputs.rustup_home }}
229
+ PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ needs.setup_rust.outputs.cargo_home }}/bin
196
230
steps :
197
231
- name : Checkout
198
232
uses : actions/checkout@v4
199
233
with :
200
- submodules : true
234
+ submodules : recursive
235
+ - name : Setup Rust environment
236
+ uses : actions-rs/toolchain@v1
237
+ with :
238
+ toolchain : stable
239
+ target : thumbv6m-none-eabi
240
+ override : true
241
+ profile : minimal
242
+ - name : Cache Rust dependencies
243
+ uses : actions/cache@v3
244
+ with :
245
+ path : |
246
+ ${{ needs.setup_rust.outputs.cargo_home }}
247
+ target/
248
+ key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
249
+ restore-keys : |
250
+ ${{ runner.os }}-rust-
201
251
- name : Install deps
202
252
run : pip install ledgerblue --break-system-packages
203
253
@@ -221,19 +271,47 @@ jobs:
221
271
prerelease : false
222
272
223
273
build_package_nanosp :
224
- needs : [configure, build, build_ledger, test_zemu, rust_tests]
274
+ needs :
275
+ [
276
+ configure,
277
+ setup_rust,
278
+ build_ledger,
279
+ tests_zemu_setup,
280
+ test_zemu,
281
+ rust_tests,
282
+ ]
225
283
if : ${{ github.ref == 'refs/heads/main' }}
226
284
runs-on : ubuntu-latest
227
285
container :
228
286
image : zondax/ledger-app-builder:latest
229
- options : --user ${{ needs.configure.outputs.uid_gid }}
287
+ options : --user root
230
288
env :
231
289
BOLOS_SDK : /opt/nanosplus-secure-sdk
290
+ HOME : /root
291
+ CARGO_HOME : ${{ needs.setup_rust.outputs.cargo_home }}
292
+ RUSTUP_HOME : ${{ needs.setup_rust.outputs.rustup_home }}
293
+ PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ needs.setup_rust.outputs.cargo_home }}/bin
232
294
steps :
233
295
- name : Checkout
234
296
uses : actions/checkout@v4
235
297
with :
236
- submodules : true
298
+ submodules : recursive
299
+ - name : Setup Rust environment
300
+ uses : actions-rs/toolchain@v1
301
+ with :
302
+ toolchain : stable
303
+ target : thumbv6m-none-eabi
304
+ override : true
305
+ profile : minimal
306
+ - name : Cache Rust dependencies
307
+ uses : actions/cache@v3
308
+ with :
309
+ path : |
310
+ ${{ needs.setup_rust.outputs.cargo_home }}
311
+ target/
312
+ key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
313
+ restore-keys : |
314
+ ${{ runner.os }}-rust-
237
315
- name : Install deps
238
316
run : pip install ledgerblue --break-system-packages
239
317
@@ -257,19 +335,47 @@ jobs:
257
335
prerelease : false
258
336
259
337
build_package_stax :
260
- needs : [configure, build, build_ledger, test_zemu, rust_tests]
338
+ needs :
339
+ [
340
+ configure,
341
+ setup_rust,
342
+ build_ledger,
343
+ tests_zemu_setup,
344
+ test_zemu,
345
+ rust_tests,
346
+ ]
261
347
if : ${{ github.ref == 'refs/heads/main' }}
262
348
runs-on : ubuntu-latest
263
349
container :
264
350
image : zondax/ledger-app-builder:latest
265
- options : --user ${{ needs.configure.outputs.uid_gid }}
351
+ options : --user root
266
352
env :
267
353
BOLOS_SDK : /opt/stax-secure-sdk
354
+ HOME : /root
355
+ CARGO_HOME : ${{ needs.setup_rust.outputs.cargo_home }}
356
+ RUSTUP_HOME : ${{ needs.setup_rust.outputs.rustup_home }}
357
+ PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ needs.setup_rust.outputs.cargo_home }}/bin
268
358
steps :
269
359
- name : Checkout
270
360
uses : actions/checkout@v4
271
361
with :
272
- submodules : true
362
+ submodules : recursive
363
+ - name : Setup Rust environment
364
+ uses : actions-rs/toolchain@v1
365
+ with :
366
+ toolchain : stable
367
+ target : thumbv6m-none-eabi
368
+ override : true
369
+ profile : minimal
370
+ - name : Cache Rust dependencies
371
+ uses : actions/cache@v3
372
+ with :
373
+ path : |
374
+ ${{ needs.setup_rust.outputs.cargo_home }}
375
+ target/
376
+ key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
377
+ restore-keys : |
378
+ ${{ runner.os }}-rust-
273
379
- name : Install deps
274
380
run : pip install ledgerblue --break-system-packages
275
381
@@ -293,19 +399,47 @@ jobs:
293
399
prerelease : false
294
400
295
401
build_package_flex :
296
- needs : [configure, build, build_ledger, test_zemu, rust_tests]
402
+ needs :
403
+ [
404
+ configure,
405
+ setup_rust,
406
+ build_ledger,
407
+ tests_zemu_setup,
408
+ test_zemu,
409
+ rust_tests,
410
+ ]
297
411
if : ${{ github.ref == 'refs/heads/main' }}
298
412
runs-on : ubuntu-latest
299
413
container :
300
414
image : zondax/ledger-app-builder:latest
301
- options : --user ${{ needs.configure.outputs.uid_gid }}
415
+ options : --user root
302
416
env :
303
417
BOLOS_SDK : /opt/flex-secure-sdk
418
+ HOME : /root
419
+ CARGO_HOME : ${{ needs.setup_rust.outputs.cargo_home }}
420
+ RUSTUP_HOME : ${{ needs.setup_rust.outputs.rustup_home }}
421
+ PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ needs.setup_rust.outputs.cargo_home }}/bin
304
422
steps :
305
423
- name : Checkout
306
424
uses : actions/checkout@v4
307
425
with :
308
- submodules : true
426
+ submodules : recursive
427
+ - name : Setup Rust environment
428
+ uses : actions-rs/toolchain@v1
429
+ with :
430
+ toolchain : stable
431
+ target : thumbv6m-none-eabi
432
+ override : true
433
+ profile : minimal
434
+ - name : Cache Rust dependencies
435
+ uses : actions/cache@v3
436
+ with :
437
+ path : |
438
+ ${{ needs.setup_rust.outputs.cargo_home }}
439
+ target/
440
+ key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
441
+ restore-keys : |
442
+ ${{ runner.os }}-rust-
309
443
- name : Install deps
310
444
run : pip install ledgerblue --break-system-packages
311
445
0 commit comments