Skip to content

Build and Test with last nightly #597

Build and Test with last nightly

Build and Test with last nightly #597

name: Build and Test with last nightly everyday @12PM
on:
workflow_dispatch:
# schedule:
# * is a special character in YAML so you have to quote this string
# - cron: '0 12 * * *'
jobs:
call_get_app_metadata:
# This job digests inputs and repository metadata provided by the `ledger_app.toml` manifest
# file, in order to output relevant directories, compatible devices, and other variables needed
# by following jobs.
name: Retrieve application metadata
uses: LedgerHQ/ledger-app-workflows/.github/workflows/_get_app_metadata.yml@v1
with:
app_repository: LedgerHQ/app-boilerplate-rust
build_with_last_nightly:
needs: call_get_app_metadata
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
strategy:
matrix:
device: ${{ fromJSON(needs.call_get_app_metadata.outputs.compatible_devices) }}
steps:
- name: install nightly toolchain
run: |
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
export RUST_NIGHTLY=nightly
cargo ledger setup
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: LedgerHQ/app-boilerplate-rust
- name: Patch Cargo.toml to use y333/nightly_support for ledger_device_sdk and include_gif crate
run: |
cd ${{ needs.call_get_app_metadata.outputs.build_directory }}
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
sed -i 's|include_gif = ".*"|include_gif = { git = "https://github.com/LedgerHQ/ledger-device-rust-sdk.git", branch = "y333/nightly_support" }|' Cargo.toml
echo "Display patched Cargo.toml:"
cat Cargo.toml
- name: Build
run: |
cargo update include_gif
cargo update ledger_secure_sdk_sys
cargo update ledger_device_sdk
# if ${{matrix.device}} is 'nanosp', transform to 'nanosplus' for cargo ledger build command
if [ "${{ matrix.device }}" = "nanosp" ]; then
DEVICE="nanosplus"
else
DEVICE="${{ matrix.device }}"
fi
echo "DEVICE=$DEVICE" >> $GITHUB_ENV
echo "Building for device: $DEVICE"
cargo ledger build $DEVICE
ELF_NAME=$(cargo metadata --manifest-path ./Cargo.toml --no-deps --format-version 1 | jq -r '.packages[] | select(.metadata.ledger != null) | .name')
echo "ELF_NAME=$ELF_NAME" >> $GITHUB_ENV
echo "Built ELF name is $ELF_NAME"
- name: Upload binary artifacts
uses: actions/upload-artifact@v4
with:
name: "app_elf_${{ matrix.device }}"
path: target/${{ env.DEVICE }}/release/${{ env.ELF_NAME }}
if-no-files-found: error
merge_artifacts:
name: Merge build artifacts
needs: build_with_last_nightly
runs-on: ubuntu-22.04
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
pattern: "app_elf_*"
#ragger_tests:
# name: Run ragger tests using the reusable workflow
# needs: build_with_last_nightly
# uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
# with:
# app_repository: LedgerHQ/app-boilerplate-rust
# app_branch_name: "main"
# download_app_binaries_artifact: "app_elf_binaries"