Skip to content

Commit d334531

Browse files
committed
Manage use cases in reusable_build workflow
1 parent bf3f9cd commit d334531

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/_get_app_metadata.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ on:
2727
required: false
2828
default: 'None'
2929
type: string
30+
flags:
31+
description: "Additional compilation flags (default to none)"
32+
required: false
33+
default: ''
34+
type: string
35+
use_case:
36+
description: "The use case to build the application for"
37+
required: false
38+
default: ''
39+
type: string
3040
outputs:
3141
is_rust:
3242
description: Returns "true" if the app is using Rust SDK, else returns "false"
@@ -40,6 +50,10 @@ on:
4050
description:
4151
The list of device(s) supported by the application.
4252
value: ${{ jobs.fetch_metadata.outputs.compatible_devices }}
53+
flags:
54+
description: |
55+
The additional compilation flags to use when building the application.
56+
value: ${{ jobs.fetch_metadata.outputs.flags }}
4357

4458
env:
4559
APP_MANIFEST: "ledger_app.toml"
@@ -112,10 +126,23 @@ jobs:
112126
echo "is_rust=false" >> "$GITHUB_OUTPUT"
113127
fi
114128
129+
# Compilation flags
130+
if [ -n "${{ inputs.flags }}" ]; then
131+
echo "flags=${{ inputs.flags }}" >> "$GITHUB_OUTPUT"
132+
elif [ -n "${{ inputs.use_case }}" ]; then
133+
# if a use case is provided, we use the one from the manifest
134+
use_case=${{ inputs.use_case }}
135+
echo "use_case is set to '${use_case}'"
136+
echo "flags=$(ledger-manifest "$APP_MANIFEST" --output-use-cases ${use_case})" >> "$GITHUB_OUTPUT"
137+
else
138+
echo "flags=" >> "$GITHUB_OUTPUT"
139+
fi
140+
115141
echo "Inferred metadata:"
116142
cat "$GITHUB_OUTPUT"
117143
118144
outputs:
119145
is_rust: ${{ steps.fetch_metadata.outputs.is_rust }}
120146
compatible_devices: ${{ steps.fetch_metadata.outputs.compatible_devices }}
121147
build_directory: ${{ steps.fetch_metadata.outputs.build_directory }}
148+
flags: ${{ steps.fetch_metadata.outputs.flags }}

.github/workflows/reusable_build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: false
2323
default: ''
2424
type: string
25+
use_case:
26+
description: "The use case to build the application for"
27+
required: false
28+
default: ''
29+
type: string
2530
upload_app_binaries_artifact:
2631
description: "The name of the artifact containing the built application binary file(s) to be tested"
2732
required: false
@@ -74,6 +79,8 @@ jobs:
7479
app_repository: ${{ inputs.app_repository }}
7580
app_branch_name: ${{ inputs.app_branch_name }}
7681
compatible_devices: ${{ inputs.run_for_devices }}
82+
flags: ${{ inputs.flags }}
83+
use_case: ${{ inputs.use_case }}
7784
secrets:
7885
token: ${{ secrets.token }}
7986

@@ -127,7 +134,7 @@ jobs:
127134
ADDITIONAL_ARGS="TARGET=${{ matrix.device }}"
128135
fi
129136
echo "Compiling..."
130-
make -C ${{ needs.call_get_app_metadata.outputs.build_directory }} -j ${{ inputs.flags }} ${ADDITIONAL_ARGS} BOLOS_SDK=${BOLOS_SDK}
137+
make -C ${{ needs.call_get_app_metadata.outputs.build_directory }} -j ${{ needs.call_get_app_metadata.outputs.flags }} ${ADDITIONAL_ARGS} BOLOS_SDK=${BOLOS_SDK}
131138
echo "binary_path=${{ needs.call_get_app_metadata.outputs.build_directory }}/build/*" >> $GITHUB_OUTPUT
132139
echo "Build complete"
133140
fi

0 commit comments

Comments
 (0)