Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/build_all_apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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-kadena'
branch: 'develop'
- repo: 'app-sui'
branch: 'develop'
- repo: 'app-pocket'
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
# Patch ledger_device_sdk
if grep -Fxq "[patch.crates-io.ledger_device_sdk]" Cargo.toml; then
echo "The patch already exists in the file."
exit 1
else
echo "" >> Cargo.toml
echo "[patch.crates-io.ledger_device_sdk]" >> Cargo.toml
path=\"$GITHUB_WORKSPACE/sdk/ledger_device_sdk\"
echo "path=$path" >> Cargo.toml
echo "Patch added to Cargo.toml"
fi
# Patch ledger_secure_sdk_sys
if grep -Fxq "[patch.crates-io.ledger_secure_sdk_sys]" Cargo.toml; then
echo "The patch already exists in the file."
exit 1
else
echo "" >> Cargo.toml
echo "[patch.crates-io.ledger_secure_sdk_sys]" >> Cargo.toml
path=\"$GITHUB_WORKSPACE/sdk/ledger_secure_sdk_sys\"
echo "path=$path" >> Cargo.toml
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
matrix:
target: ["nanos", "nanox", "nanosplus"]
steps:
- name: Force speculos update
run: |
pip3 install --no-cache-dir speculos --upgrade
- name: Clone
uses: actions/checkout@v4
- name: Unit tests
Expand Down