Update API_LEVEL_21 #1532
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 apps on latest SDK | |
on: | |
workflow_dispatch: | |
inputs: | |
sdk_branch: | |
type: string | |
required: false | |
default: '' | |
pull_request: | |
env: | |
BLACKLIST: "app-avalanche" # Add the names of the repositories to exclude here, separated by commas | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install tomlq | |
run: | | |
python -m pip install tomlq | |
- name: Get C apps repos | |
run: | | |
page=1 | |
result=() | |
while true; do | |
repos=$(curl -s "https://api.github.com/orgs/LedgerHQ/repos?page=$page&per_page=200&type=public") | |
if ! echo "$repos" | jq -e '.[].name' >/dev/null; then | |
# all repos have been listed | |
echo "all repos have been listed" | |
break | |
fi | |
# add filtered repos to the list | |
for repo in $(echo "$repos" | jq -r '.[] | select((.name | startswith("app-")) and (.archived == false)) | .name'); do | |
default_branch=$(echo "$repos" | jq -r --arg repo "$repo" '.[] | select(.name == $repo) | .default_branch') | |
if [[ ! " ${BLACKLIST//,/ } " =~ " $repo " ]]; then | |
result+=("$repo,$default_branch") | |
else | |
echo "Skipping blacklisted repository: $repo" | |
fi | |
done | |
((page++)) | |
done | |
echo "repo_list=${result[@]}" >> $GITHUB_ENV | |
- name: Extract metadata | |
id: set-matrix | |
run: | | |
repo_info="[" | |
for repo in ${{ env.repo_list }}; do | |
repo_name=$(echo "$repo" | cut -d ',' -f 1) | |
default_branch=$(echo "$repo" | cut -d ',' -f 2) | |
toml_content=$(curl -s "https://raw.githubusercontent.com/LedgerHQ/$repo_name/$default_branch/ledger_app.toml") | |
# check if the toml file is present in the repo and if the repo is not for a rust app | |
if [[ ! $toml_content =~ "404: Not Found" ]]; then | |
# read toml file attributes | |
build_directory=$(echo "$toml_content" | tomlq -r '.app.build_directory') | |
sdk=$(echo "$toml_content" | tomlq -r '.app.sdk') | |
devices=$(echo "$toml_content" | tomlq -r '.app.devices | join(", ")') | |
# select only C apps | |
if [[ $sdk == "C" ]]; then | |
repo_info+="{\"repo_name\": \"$repo_name\",\"default_branch\": \"$default_branch\", \"build_directory\": \"$build_directory\", \"sdk\": \"$sdk\", \"devices\": \"$devices\"}," | |
fi | |
else | |
echo "$repo does not contain ledger_app.toml" | |
fi | |
done | |
# remove the last "," in json | |
repo_info_json="${repo_info%,}" | |
repo_info_json+="]" | |
echo "matrix=$repo_info_json" >> $GITHUB_OUTPUT | |
print-matrix: | |
needs: [prepare-matrix] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print matrix | |
run: | | |
echo "Matrix content: ${{ needs.prepare-matrix.outputs.matrix }}" | |
test-build: | |
name: Build for all targets | |
needs: [prepare-matrix] | |
strategy: | |
fail-fast: false | |
matrix: | |
repo_info: ${{ 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: LedgerHQ/${{ matrix.repo_info.repo_name }} | |
ref: ${{ matrix.repo_info.default_branch }} | |
submodules: true | |
- name: Clone SDK | |
uses: actions/checkout@v4 | |
with: | |
path: sdk | |
ref: ${{ inputs.sdk_branch }} | |
- name: Build NanoX | |
if: "contains(matrix.repo_info.devices, 'nanox')" | |
run: | | |
[ -n '${{ matrix.repo_info.build_directory }}' ] && cd ${{ matrix.repo_info.build_directory }} | |
TARGET=nanox BOLOS_SDK=$GITHUB_WORKSPACE/sdk make | |
- name: Build NanoS2 | |
if: "contains(matrix.repo_info.devices, 'nanos+')" | |
run: | | |
[ -n '${{ matrix.repo_info.build_directory }}' ] && cd ${{ matrix.repo_info.build_directory }} | |
TARGET=nanos2 BOLOS_SDK=$GITHUB_WORKSPACE/sdk make | |
- name: Build Stax | |
if: "contains(matrix.repo_info.devices, 'stax')" | |
run: | | |
[ -n '${{ matrix.repo_info.build_directory }}' ] && cd ${{ matrix.repo_info.build_directory }} | |
TARGET=stax BOLOS_SDK=$GITHUB_WORKSPACE/sdk make | |
- name: Build Flex | |
if: "contains(matrix.repo_info.devices, 'flex')" | |
run: | | |
[ -n '${{ matrix.repo_info.build_directory }}' ] && cd ${{ matrix.repo_info.build_directory }} | |
TARGET=flex BOLOS_SDK=$GITHUB_WORKSPACE/sdk make |