Skip to content

Commit fcc50f3

Browse files
authored
Merge pull request #291 from LedgerHQ/y333/fix_nightly_build_and_test_all_apps
Fix workflow
2 parents 7062a62 + d12a11a commit fcc50f3

File tree

2 files changed

+81
-27
lines changed

2 files changed

+81
-27
lines changed

.github/workflows/nightly_build_and_test.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ permissions:
33
contents: read
44

55
on:
6-
workflow_call:
76
workflow_dispatch:
8-
schedule:
9-
# * is a special character in YAML so you have to quote this string
10-
- cron: '0 12 * * *'
117

128
jobs:
139
retrieve-rust-apps:
@@ -31,7 +27,7 @@ jobs:
3127
id: get_rust_apps
3228
run: |
3329
python .github/workflows/get_rust_app_branch.py ${{ secrets.GITHUB_TOKEN }}
34-
echo "rust_apps=$(cat rust_apps.json)" >> $GITHUB_OUTPUT
30+
echo "rust_apps=$(cat rust_app_branch.json)" >> $GITHUB_OUTPUT
3531
3632
display-rust-apps:
3733
name: Display Rust Apps
@@ -53,5 +49,5 @@ jobs:
5349
include: ${{ fromJSON(needs.retrieve-rust-apps.outputs.rust_apps) }}
5450
uses: ./.github/workflows/reusable_build_and_test_with_last_nightly.yml
5551
with:
56-
app-repository: ${{ matrix.app-repo }}
57-
app-branch-name: ${{ matrix.app-branch }}
52+
app_name: ${{ matrix.app-name }}
53+
app_branch: ${{ matrix.app-branch }}

.github/workflows/reusable_build_and_test_with_last_nightly.yml

Lines changed: 78 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ permissions:
55
on:
66
workflow_call:
77
inputs:
8-
app_repository:
9-
description: 'The repository of the application to build and test'
8+
app_name:
9+
description: 'The name of the application to build and test'
1010
required: true
1111
type: string
12-
app_branch_name:
12+
app_branch:
1313
description: 'The branch of the application to build and test'
1414
required: true
1515
type: string
1616
workflow_dispatch:
1717
inputs:
18-
app_repository:
19-
description: 'The repository of the application to build and test'
18+
app_name:
19+
description: 'The name of the application to build and test'
2020
required: true
21-
app_branch_name:
21+
app_branch:
2222
description: 'The branch of the application to build and test'
2323
required: true
2424
# schedule:
@@ -33,8 +33,8 @@ jobs:
3333
name: Retrieve application metadata
3434
uses: LedgerHQ/ledger-app-workflows/.github/workflows/_get_app_metadata.yml@v1
3535
with:
36-
app_repository: ${{ inputs.app_repository }}
37-
app_branch_name: ${{ inputs.app_branch_name }}
36+
app_repository: LedgerHQ/${{ inputs.app_name }}
37+
app_branch_name: ${{ inputs.app_branch }}
3838

3939
build_with_last_nightly:
4040
needs: call_get_app_metadata
@@ -55,19 +55,39 @@ jobs:
5555
- name: Checkout Code
5656
uses: actions/checkout@v4
5757
with:
58-
repository: ${{ inputs.app_repository }}
59-
ref: ${{ inputs.app_branch_name }}
58+
repository: LedgerHQ/${{ inputs.app_name }}
59+
ref: ${{ inputs.app_branch }}
60+
path: ${{ inputs.app_name }}
61+
submodules: true
6062

61-
- name: Patch Cargo.toml to use y333/nightly_support for ledger_device_sdk and include_gif crate
63+
- name: Patch Cargo.toml to use y333/nightly_support for ledger_device_sdk, ledger_secure_sdk_sys, include_gif crates
6264
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
65+
cd ${{ inputs.app_name }}/${{ needs.call_get_app_metadata.outputs.build_directory }}
66+
67+
# Patch include_gif
68+
echo "" >> Cargo.toml && \
69+
echo "[patch.crates-io.include_gif]" >> Cargo.toml && \
70+
echo "git = \"https://github.com/LedgerHQ/ledger-device-rust-sdk.git\"" >> Cargo.toml && \
71+
echo "branch = \"y333/nightly_support\"" >> Cargo.toml
72+
73+
# Patch ledger_secure_sdk_sys
74+
echo "" >> Cargo.toml && \
75+
echo "[patch.crates-io.ledger_secure_sdk_sys]" >> Cargo.toml && \
76+
echo "git = \"https://github.com/LedgerHQ/ledger-device-rust-sdk.git\"" >> Cargo.toml && \
77+
echo "branch = \"y333/nightly_support\"" >> Cargo.toml
78+
79+
# Patch ledger_device_sdk
80+
echo "" >> Cargo.toml && \
81+
echo "[patch.crates-io.ledger_device_sdk]" >> Cargo.toml && \
82+
echo "git = \"https://github.com/LedgerHQ/ledger-device-rust-sdk.git\"" >> Cargo.toml && \
83+
echo "branch = \"y333/nightly_support\"" >> Cargo.toml
84+
6685
echo "Display patched Cargo.toml:"
6786
cat Cargo.toml
6887
6988
- name: Build
7089
run: |
90+
cd ${{ inputs.app_name }}/${{ needs.call_get_app_metadata.outputs.build_directory }}
7191
cargo update include_gif
7292
cargo update ledger_secure_sdk_sys
7393
cargo update ledger_device_sdk
@@ -91,10 +111,35 @@ jobs:
91111
- name: Upload binary artifacts
92112
uses: actions/upload-artifact@v4
93113
with:
94-
name: "app_binaries-${{ matrix.device }}"
114+
name: "${{ inputs.app_name }}_binaries-${{ matrix.device }}"
95115
path: ${{env.BINARY_PATH}}
96116
if-no-files-found: error
97117

118+
build_check_signature_starknet:
119+
name: Build binary used to check signture during the test
120+
if: ${{ inputs.app_name == 'app-starknet' }}
121+
runs-on: ubuntu-latest
122+
container:
123+
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
124+
steps:
125+
- name: Clone
126+
uses: actions/checkout@v4
127+
with:
128+
repository: LedgerHQ/${{ inputs.app_name }}
129+
ref: ${{ inputs.app_branch }}
130+
path: ${{ inputs.app_name }}
131+
submodules: true
132+
- name: Build
133+
working-directory: ${{ inputs.app_name }}/tools/check-signature
134+
run: |
135+
cargo build
136+
- name: Upload app binary
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: check-signature
140+
path: ${{ inputs.app_name }}/tools/check-signature/target/debug/check-signature
141+
if-no-files-found: error
142+
98143
merge_artifacts:
99144
name: Merge build artifacts
100145
needs: build_with_last_nightly
@@ -103,15 +148,28 @@ jobs:
103148
- name: Merge artifacts
104149
uses: actions/upload-artifact/merge@v4
105150
with:
106-
name: "app_binaries"
107-
pattern: "app_binaries-*"
151+
name: "${{ inputs.app_name }}_binaries"
152+
pattern: "${{ inputs.app_name }}_binaries-*"
108153
delete-merged: true
109154

110155
ragger_tests:
111156
name: Run ragger tests using the reusable workflow
157+
if: ${{ inputs.app_name != 'app-starknet' }}
112158
needs: merge_artifacts
113159
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
114160
with:
115-
app_repository: ${{ inputs.app_repository }}
116-
app_branch_name: ${{ inputs.app_branch_name }}
117-
download_app_binaries_artifact: "app_binaries"
161+
app_repository: LedgerHQ/${{ inputs.app_name }}
162+
app_branch_name: ${{ inputs.app_branch }}
163+
download_app_binaries_artifact: "${{ inputs.app_name }}_binaries"
164+
165+
ragger_tests_starknet:
166+
name: Run ragger tests using the reusable workflow
167+
if: ${{ inputs.app_name == 'app-starknet' }}
168+
needs: [merge_artifacts, build_check_signature_starknet]
169+
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
170+
with:
171+
app_repository: LedgerHQ/${{ inputs.app_name }}
172+
app_branch_name: ${{ inputs.app_branch }}
173+
download_app_binaries_artifact: "${{ inputs.app_name }}_binaries"
174+
additional_app_binaries_artifact: "check-signature"
175+
additional_app_binaries_artifact_dir: "tools/check-signature/target/debug"

0 commit comments

Comments
 (0)