Update build_all_apps.yml #256
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build all Rust apps | |
on: | |
workflow_dispatch: | |
inputs: | |
sdk_branch: | |
type: string | |
required: false | |
default: '' | |
pull_request: | |
jobs: | |
test-build: | |
name: Build for all targets | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- repo: 'app-radix-babylon' | |
branch: 'develop' | |
- repo: 'app-sui' | |
branch: 'develop' | |
- repo: 'app-pocket' | |
branch: 'develop' | |
- repo: 'app-starknet' | |
branch: 'develop' | |
- repo: 'app-alephium' | |
branch: 'develop' | |
- repo: 'app-boilerplate-rust' | |
branch: 'main' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest | |
steps: | |
- name: Install dependencies | |
run: pip install ledgered | |
- name: Clone SDK | |
uses: actions/checkout@v4 | |
with: | |
path: sdk | |
- name: Clone App | |
uses: actions/checkout@v4 | |
with: | |
repository: LedgerHQ/${{ matrix.repo }} | |
submodules: true | |
ref: ${{ matrix.branch }} | |
path: ${{ matrix.repo }}-${{ matrix.branch }} | |
- name: Patch Cargo.toml | |
continue-on-error: false | |
run: | | |
cd ${{ matrix.repo }}-${{ matrix.branch }} | |
build_directory=$(ledger-manifest --output-build-directory ledger_app.toml) | |
cd $build_directory | |
# Determine if the project is a workspace and get the workspace root path | |
if cargo metadata --no-deps --format-version 1 | jq -e '.workspace_members | length > 0' > /dev/null; then | |
echo "Workspace detected. Retrieving workspace root path." | |
workspace_root=$(cargo metadata --no-deps --format-version 1 | jq -r '.workspace_root') | |
cargo_toml_path="$workspace_root/Cargo.toml" | |
else | |
echo "No workspace detected. Using Cargo.toml in the current directory." | |
cargo_toml_path="$(pwd)/Cargo.toml" | |
fi | |
# Patch ledger_device_sdk | |
if grep -Fxq "[patch.crates-io.ledger_device_sdk]" $cargo_toml_path; then | |
echo "The patch already exists in the file." | |
exit 1 | |
else | |
echo "" >> $cargo_toml_path | |
echo "[patch.crates-io.ledger_device_sdk]" >> $cargo_toml_path | |
path=\"$GITHUB_WORKSPACE/sdk/ledger_device_sdk\" | |
echo "path=$path" >> $cargo_toml_path | |
echo "Patch added to Cargo.toml" | |
fi | |
# Patch ledger_secure_sdk_sys | |
if grep -Fxq "[patch.crates-io.ledger_secure_sdk_sys]" $cargo_toml_path; then | |
echo "The patch already exists in the file." | |
exit 1 | |
else | |
echo "" >> $cargo_toml_path | |
echo "[patch.crates-io.ledger_secure_sdk_sys]" >> $cargo_toml_path | |
path=\"$GITHUB_WORKSPACE/sdk/ledger_secure_sdk_sys\" | |
echo "path=$path" >> $cargo_toml_path | |
echo "Patch added to Cargo.toml" | |
fi | |
- name: Build | |
run: | | |
cd ${{ matrix.repo }}-${{ matrix.branch }} | |
build_directory=$(ledger-manifest --output-build-directory ledger_app.toml) | |
devices="$(ledger-manifest --output-devices ledger_app.toml -j | sed 's/+/plus/' | jq -rc '.devices[]')" | |
cd $build_directory | |
for device in $devices; do | |
# Required as patch has a different version from what is locked in Cargo.lock | |
cargo +$RUST_NIGHTLY update ledger_device_sdk | |
cargo +$RUST_NIGHTLY update ledger_secure_sdk_sys | |
echo "Build for "$device | |
cargo ledger build $device | |
done |