|
8 | 8 | default: ''
|
9 | 9 | type: string
|
10 | 10 | workflow_dispatch:
|
11 |
| - inputs: |
12 |
| - c_sdk_branch: |
13 |
| - type: string |
14 |
| - required: false |
15 |
| - default: '' |
16 | 11 | pull_request:
|
17 | 12 |
|
18 | 13 | env:
|
19 | 14 | C_SDK_URL: 'https://github.com/LedgerHQ/ledger-secure-sdk.git'
|
| 15 | + RUST_SDK_URL: 'https://github.com/LedgerHQ/ledger-device-rust-sdk.git' |
20 | 16 |
|
21 | 17 | jobs:
|
| 18 | + how-workflow-is-called: |
| 19 | + name: Determine how the workflow is called |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + repository: ${{ steps.get_repo_and_branch.outputs.repo }} |
| 23 | + branch: ${{ steps.get_repo_and_branch.outputs.branch }} |
| 24 | + steps: |
| 25 | + - name: Get repository and branch |
| 26 | + id: get_repo_and_branch |
| 27 | + run: | |
| 28 | + if [ -n "${{ github.event.inputs.c_sdk_branch }}" ]; then |
| 29 | + echo "repo=$RUST_SDK_URL" >> $GITHUB_OUTPUT |
| 30 | + echo "branch='refs/heads/master'" >> $GITHUB_OUTPUT |
| 31 | + else |
| 32 | + echo "repo=${{ github.repository}}" >> $GITHUB_OUTPUT |
| 33 | + echo "branch=${{ github.ref }}" >> $GITHUB_OUTPUT |
| 34 | + fi |
22 | 35 | retrieve-rust-apps:
|
23 | 36 | name: Retrieve Rust Apps
|
24 | 37 | runs-on: ubuntu-latest
|
| 38 | + needs: how-workflow-is-called |
25 | 39 | outputs:
|
26 | 40 | rust_apps: ${{ steps.get_rust_apps.outputs.rust_apps }}
|
27 | 41 | exclude_apps: ${{ steps.get_rust_apps.outputs.exclude_apps }}
|
28 | 42 | ledger_devices: ${{ steps.get_rust_apps.outputs.ledger_devices }}
|
29 | 43 | steps:
|
30 |
| - - name: Display context |
31 |
| - run: | |
32 |
| - echo "github.repository: ${{ github.repository }}" |
33 |
| - echo "github.ref: ${{ github.ref }}" |
34 |
| - echo "github.event_name: ${{ github.event_name }}" |
35 |
| - echo "github.head_ref: ${{ github.head_ref }}" |
36 |
| - echo "github.event.inputs.c_sdk_branch: ${{ github.event.inputs.c_sdk_branch }}" |
37 | 44 | - name: Checkout repository
|
38 | 45 | uses: actions/checkout@v4
|
39 | 46 | with:
|
40 |
| - repository: ${{ github.repository }} |
41 |
| - ref: ${{ github.event_name == 'workflow_call' && 'refs/heads/master' || github.ref }} |
| 47 | + repository: ${{ needs.how-workflow-is-called.outputs.repository }} |
| 48 | + ref: ${{ needs.how-workflow-is-called.outputs.branch }} |
42 | 49 | - name: Set up Python
|
43 | 50 | uses: actions/setup-python@v4
|
44 | 51 | with:
|
|
66 | 73 |
|
67 | 74 | test-build:
|
68 | 75 | name: Build for all targets
|
69 |
| - needs: retrieve-rust-apps |
| 76 | + needs: [retrieve-rust-apps, how-workflow-is-called] |
70 | 77 | strategy:
|
71 | 78 | fail-fast: false
|
72 | 79 | matrix:
|
|
83 | 90 | uses: actions/checkout@v4
|
84 | 91 | with:
|
85 | 92 | path: sdk
|
86 |
| - repository: ${{ github.repository }} |
87 |
| - ref: ${{ github.event_name == 'workflow_call' && 'refs/heads/master' || github.ref }} |
| 93 | + repository: ${{ needs.how-workflow-is-called.outputs.repository }} |
| 94 | + ref: ${{ needs.how-workflow-is-called.outputs.branch }} |
88 | 95 | - name: Clone App
|
89 | 96 | uses: actions/checkout@v4
|
90 | 97 | with:
|
|
0 commit comments