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