Skip to content

add workflow to build all Rust apps for every PR #16

add workflow to build all Rust apps for every PR

add workflow to build all Rust apps for every PR #16

Workflow file for this run

name: Build all Rust apps
on:
workflow_dispatch:
inputs:
sdk_branch:
type: string
required: false
default: ''
pull_request:
env:
REPO_BRANCH_PAIRS:
'[
{"repo":"LedgerHQ/app-mobilecoin", "branch":"develop"},
{"repo":"LedgerHQ/app-radix-babylon", "branch":"develop"},
{"repo":"LedgerHQ/app-boilerplate-rust", "branch":"main"}
]'
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
echo 'matrix=${{ env.REPO_BRANCH_PAIRS }}' >> $GITHUB_ENV
echo "MATRIX_JSON<<EOF" >> $GITHUB_ENV
echo ${{ env.REPO_BRANCH_PAIRS }} >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
test-build:
name: Build for all targets
needs: [prepare-matrix]
strategy:
fail-fast: false
matrix:
${{ fromJSON(needs.prepare-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone App
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/${{ matrix.repo }}
submodules: true
ref: ${{ matrix.branch }}
path: ${{ github.workspace }}/${{ matrix.repo }}-${{ matrix.branch }}
- name: Build Path and Targets
run: |
cargo +$RUST_STABLE install toml-cli
cd ${{ github.workspace }}/${{ matrix.repo }}-${{ matrix.branch }}
build_path=$(toml get ledger_app.toml app.build_directory)
echo "build_path=$build_path" >> $GITHUB_ENV
for device in nanos "nanos+" nanox; do
build_device=$(toml get ledger_app.toml app.devices | grep -o "\"$device\"" | sed 's/"/'/g | sed 's/+/plus/')
if [ -n "$build_device" ]; then
echo "build_${build_device}=true" >> $GITHUB_ENV
fi
done
- name: Build NanoS
if: ${{ env.build_nanos == 'true' }}
run: |
cd ${{ github.workspace }}/${{ matrix.repo }}-${{ matrix.branch }}
cd ${{ env.build_path }}
echo "Build for Nano S"
- name: Build NanoX
if: ${{ env.build_nanox == 'true' }}
run: |
cd ${{ github.workspace }}/${{ matrix.repo }}-${{ matrix.branch }}
cd ${{ env.build_path }}
echo "Build for Nano X"
- name: Build NanoS+
if: ${{ env.build_nanosplus == 'true' }}
run: |
cd ${{ github.workspace }}/${{ matrix.repo }}-${{ matrix.branch }}
cd ${{ env.build_path }}
echo "Build for Nano S+"