1
- name : Build and Test with last nightly everyday @12PM
1
+ name : Build and Test with last nightly
2
2
3
3
on :
4
+ workflow_call :
5
+ inputs :
6
+ app_repository :
7
+ description : ' The repository of the application to build and test'
8
+ required : true
9
+ type : string
10
+ app_branch_name :
11
+ description : ' The branch of the application to build and test'
12
+ required : true
13
+ type : string
4
14
workflow_dispatch :
15
+ inputs :
16
+ app_repository :
17
+ description : ' The repository of the application to build and test'
18
+ required : true
19
+ app_branch_name :
20
+ description : ' The branch of the application to build and test'
21
+ required : true
5
22
# schedule:
6
23
# * is a special character in YAML so you have to quote this string
7
24
# - cron: '0 12 * * *'
8
25
9
26
jobs :
27
+ call_get_app_metadata :
28
+ # This job digests inputs and repository metadata provided by the `ledger_app.toml` manifest
29
+ # file, in order to output relevant directories, compatible devices, and other variables needed
30
+ # by following jobs.
31
+ name : Retrieve application metadata
32
+ uses : LedgerHQ/ledger-app-workflows/.github/workflows/_get_app_metadata.yml@v1
33
+ with :
34
+ app_repository : ${{ inputs.app_repository }}
35
+ app_branch_name : ${{ inputs.app_branch_name }}
36
+
10
37
build_with_last_nightly :
38
+ needs : call_get_app_metadata
11
39
runs-on : ubuntu-latest
12
40
container :
13
41
image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
14
42
strategy :
15
43
matrix :
16
- device : ["nanox", "nanosplus", "stax", "flex"]
44
+ device : ${{ fromJSON(needs.call_get_app_metadata.outputs.compatible_devices) }}
17
45
steps :
18
- - name : update nightly toolchain
46
+ - name : install nightly toolchain
19
47
run : |
20
- rustup update nightly
48
+ rustup toolchain install nightly
21
49
rustup component add rust-src --toolchain nightly
22
- cargo +nightly ledger setup
50
+ export RUST_NIGHTLY=nightly
51
+ cargo ledger setup
23
52
24
53
- name : Checkout Code
25
54
uses : actions/checkout@v4
26
55
with :
27
- repository : LedgerHQ/app-boilerplate-rust
28
- path : app-boilerplate
56
+ repository : ${{ inputs.app_repository }}
57
+ ref : ${{ inputs.app_branch_name }}
58
+
59
+ - name : Patch Cargo.toml to use y333/nightly_support for ledger_device_sdk and include_gif crate
60
+ run : |
61
+ cd ${{ needs.call_get_app_metadata.outputs.build_directory }}
62
+ sed -i 's|ledger_device_sdk = ".*"|ledger_device_sdk = { git = "https://github.com/LedgerHQ/ledger-device-rust-sdk.git", branch = "y333/nightly_support" }|' Cargo.toml
63
+ sed -i 's|include_gif = ".*"|include_gif = { git = "https://github.com/LedgerHQ/ledger-device-rust-sdk.git", branch = "y333/nightly_support" }|' Cargo.toml
64
+ echo "Display patched Cargo.toml:"
65
+ cat Cargo.toml
29
66
30
67
- name : Build
31
68
run : |
32
- BUILD_DEVICE_NAME="$(echo ${{ matrix.device }})"
33
- BIN_DIR_NAME="$(echo ${{ matrix.device }} | sed 's/nanosplus/nanos2/')"
34
- cd app-boilerplate
35
- cargo ledger build ${{ matrix.device }}
69
+ cargo update include_gif
70
+ cargo update ledger_secure_sdk_sys
71
+ cargo update ledger_device_sdk
72
+ # if ${{matrix.device}} is 'nanosp', transform to 'nanosplus' for cargo ledger build command
73
+ if [ "${{ matrix.device }}" = "nanosp" ]; then
74
+ DEVICE="nanosplus"
75
+ else
76
+ DEVICE="${{ matrix.device }}"
77
+ fi
78
+ echo "Building for device: $DEVICE"
79
+ cargo ledger build $DEVICE
80
+ BINARY_PATH=$(cargo metadata --no-deps --format-version 1 | jq -r '.target_directory')/ && \
81
+ echo "BINARY_PATH=$BINARY_PATH" >> $GITHUB_ENV
82
+ echo "BINARY_PATH is: $BINARY_PATH"
83
+
84
+ - name : Remove useless artifacts from previous build
85
+ run : |
86
+ find ${{ env.BINARY_PATH }} -mindepth 3 -maxdepth 3 -type d -exec rm -rf {} + && \
87
+ rm -rf ${{ env.BINARY_PATH }}/release
36
88
37
- # - name: Upload binary artifacts
38
- # uses: actions/upload-artifact@v3
39
- # with:
40
- # name: "app_elf_binaries"
41
- # path: app-boilerplate/target/*
42
- # if-no-files-found: error
43
-
44
- # ragger_tests:
45
- # name: Run ragger tests using the reusable workflow
46
- # needs: build_with_last_nightly
47
- # uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
48
- # with:
49
- # app_repository: LedgerHQ/app-boilerplate-rust
50
- # app_branch_name: "main"
51
- # download_app_binaries_artifact: "app_elf_binaries"
89
+ - name : Upload binary artifacts
90
+ uses : actions/upload-artifact@v4
91
+ with :
92
+ name : " app_binaries-${{ matrix.device }}"
93
+ path : ${{env.BINARY_PATH}}
94
+ if-no-files-found : error
95
+
96
+ merge_artifacts :
97
+ name : Merge build artifacts
98
+ needs : build_with_last_nightly
99
+ runs-on : ubuntu-22.04
100
+ steps :
101
+ - name : Merge artifacts
102
+ uses : actions/upload-artifact/merge@v4
103
+ with :
104
+ name : " app_binaries"
105
+ pattern : " app_binaries-*"
106
+ delete-merged : true
107
+
108
+ ragger_tests :
109
+ name : Run ragger tests using the reusable workflow
110
+ needs : merge_artifacts
111
+ uses : LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
112
+ with :
113
+ app_repository : ${{ inputs.app_repository }}
114
+ app_branch_name : ${{ inputs.app_branch_name }}
115
+ download_app_binaries_artifact : " app_binaries"
0 commit comments