Skip to content

Commit de6e6b4

Browse files
committed
Update nightly build workflow
1 parent a32e4ab commit de6e6b4

File tree

1 file changed

+90
-26
lines changed

1 file changed

+90
-26
lines changed
Lines changed: 90 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,115 @@
1-
name: Build and Test with last nightly everyday @12PM
1+
name: Build and Test with last nightly
22

33
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
414
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
522
# schedule:
623
# * is a special character in YAML so you have to quote this string
724
# - cron: '0 12 * * *'
825

926
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+
1037
build_with_last_nightly:
38+
needs: call_get_app_metadata
1139
runs-on: ubuntu-latest
1240
container:
1341
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
1442
strategy:
1543
matrix:
16-
device: ["nanox", "nanosplus", "stax", "flex"]
44+
device: ${{ fromJSON(needs.call_get_app_metadata.outputs.compatible_devices) }}
1745
steps:
18-
- name: update nightly toolchain
46+
- name: install nightly toolchain
1947
run: |
20-
rustup update nightly
48+
rustup toolchain install nightly
2149
rustup component add rust-src --toolchain nightly
22-
cargo +nightly ledger setup
50+
export RUST_NIGHTLY=nightly
51+
cargo ledger setup
2352
2453
- name: Checkout Code
2554
uses: actions/checkout@v4
2655
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
2966
3067
- name: Build
3168
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
3688
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

Comments
 (0)