Skip to content

Commit 7062a62

Browse files
authored
Merge pull request #290 from LedgerHQ/y333/add_workflow_build_and_test_all_apps_with_nightly
Y333/add workflow build and test all apps with nightly
2 parents b18669c + 79d9118 commit 7062a62

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from ledgered.github import GitHubLedgerHQ, NoManifestException, Condition
2+
from github.GithubException import GithubException
3+
4+
import sys
5+
import json
6+
7+
if len(sys.argv) != 2:
8+
print("Usage: get_rust_apps.py <github_token>")
9+
sys.exit(1)
10+
11+
# Excluded Rust apps
12+
# app-kadena-legacy: has been replaced by app-kadena
13+
# app-pocket: does not build (Obsidians' Alamgu issue)
14+
excluded_apps = ["app-kadena-legacy", "app-pocket"]
15+
16+
# Retrieve all public apps on LedgerHQ GitHub organization
17+
token = sys.argv[1]
18+
gh = GitHubLedgerHQ(token)
19+
apps=gh.apps.filter(private=Condition.WITHOUT, archived=Condition.WITHOUT)
20+
21+
rust_apps = []
22+
exclude_apps = []
23+
# loop all apps in gh.apps
24+
for app in apps:
25+
try:
26+
manifest = app.manifest
27+
except NoManifestException as e:
28+
pass
29+
except GithubException as e:
30+
pass
31+
else:
32+
# Filter out apps that are Rust based
33+
if manifest.app.sdk == "rust":
34+
if app.name not in excluded_apps:
35+
rust_apps.append({"app-name": app.name, "branch": app.current_branch})
36+
37+
# save the list of (apps, device) pairs to build in a json format:
38+
with open("rust_app_branch.json", "w") as f:
39+
f.write(json.dumps(rust_apps))
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Test all Apps with last nightly
2+
permissions:
3+
contents: read
4+
5+
on:
6+
workflow_call:
7+
workflow_dispatch:
8+
schedule:
9+
# * is a special character in YAML so you have to quote this string
10+
- cron: '0 12 * * *'
11+
12+
jobs:
13+
retrieve-rust-apps:
14+
name: Retrieve Rust Apps
15+
runs-on: ubuntu-latest
16+
outputs:
17+
rust_apps: ${{ steps.get_rust_apps.outputs.rust_apps }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
repository: LedgerHQ/ledger-device-rust-sdk
23+
ref: 'master'
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.x'
28+
- name: Install ledgered
29+
run: pip install ledgered
30+
- name: Get all rust apps
31+
id: get_rust_apps
32+
run: |
33+
python .github/workflows/get_rust_app_branch.py ${{ secrets.GITHUB_TOKEN }}
34+
echo "rust_apps=$(cat rust_apps.json)" >> $GITHUB_OUTPUT
35+
36+
display-rust-apps:
37+
name: Display Rust Apps
38+
runs-on: ubuntu-latest
39+
needs: retrieve-rust-apps
40+
steps:
41+
- name: Display Rust Apps
42+
run: |
43+
echo "Rust apps: ${{ needs.retrieve-rust-apps.outputs.rust_apps }}"
44+
45+
build_and_test:
46+
name: Build and test for all apps
47+
needs: retrieve-rust-apps
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
app-name: ["app-boilerplate-rust"]
52+
app-branch: ["main"]
53+
include: ${{ fromJSON(needs.retrieve-rust-apps.outputs.rust_apps) }}
54+
uses: ./.github/workflows/reusable_build_and_test_with_last_nightly.yml
55+
with:
56+
app-repository: ${{ matrix.app-repo }}
57+
app-branch-name: ${{ matrix.app-branch }}

.github/workflows/reusable_build_and_test_with_last_nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Test with last nightly
1+
name: Reusable Build and Test an App with last nightly
22
permissions:
33
contents: read
44

0 commit comments

Comments
 (0)