Skip to content

Build and Test with last nightly #600

Build and Test with last nightly

Build and Test with last nightly #600

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 "Building for device: $DEVICE"
cargo ledger build $DEVICE
BINARY_PATH=$(cargo metadata --no-deps --format-version 1 | jq -r '.target_directory')/ && \
echo "BINARY_PATH=$BINARY_PATH" >> $GITHUB_ENV
echo "BINARY_PATH is: $BINARY_PATH"
- name: Remove useless artifacts from previous build
run: |
find ${{ env.BINARY_PATH }} -mindepth 3 -maxdepth 3 -type d -exec rm -rf {} + && \
rm -rf ${{ env.BINARY_PATH }}/release
- name: Upload binary artifacts
uses: actions/upload-artifact@v4
with:
name: "app_binaries-${{ matrix.device }}"
path: ${{env.BINARY_PATH}}
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:
name: "app_binaries"
pattern: "app_binaries-*"
delete-merged: true
ragger_tests:
name: Run ragger tests using the reusable workflow
needs: merge_artifacts
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
app_repository: LedgerHQ/app-boilerplate-rust
download_app_binaries_artifact: "app_binaries"