Skip to content

Commit 50512f2

Browse files
authored
✨ Add extra_conan_arguments support to package workflows (#105)
* ✨ Add extra_conan_arguments support to package workflows Add new `extra_conan_arguments` input parameter to pass additional arguments to conan create commands. This enables customization of package builds with options like C++ modules, freestanding mode, and other conan options. - Add extra_conan_arguments input to package_and_upload_all.yml - Add extra_conan_arguments input to package_and_upload.yml - Add --extra-conan-args parameter to baremetal_package.sh - Pass arguments through to all conan create invocations * [skip ci] restore old tests
1 parent 5bd9b69 commit 50512f2

4 files changed

Lines changed: 37 additions & 11 deletions

File tree

.github/workflows/package_and_upload.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ on:
5050
remote_url: # Path to conan package repo
5151
type: string
5252
default: ""
53+
extra_conan_arguments:
54+
type: string
55+
default: ""
56+
description: "Extra arguments to pass to conan create commands"
5357

5458
secrets:
5559
conan_remote_user:
@@ -99,13 +103,13 @@ jobs:
99103
run: conan config install https://github.com/libhal/conan-config2.git --args="-b ${{ inputs.config2_version }}"
100104

101105
- name: 📦 Create `Debug` package for ${{ inputs.profile }}
102-
run: conan create ${{ inputs.dir }} -s:h build_type=Debug -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing
106+
run: conan create ${{ inputs.dir }} -s:h build_type=Debug -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing ${{ inputs.extra_conan_arguments }}
103107

104108
- name: 📦 Create `MinSizeRel` package for ${{ inputs.profile }}
105-
run: conan create ${{ inputs.dir }} -s:h build_type=MinSizeRel -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing
109+
run: conan create ${{ inputs.dir }} -s:h build_type=MinSizeRel -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing ${{ inputs.extra_conan_arguments }}
106110

107111
- name: 📦 Create `Release` package for ${{ inputs.profile }}
108-
run: conan create ${{ inputs.dir }} -s:h build_type=Release -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing
112+
run: conan create ${{ inputs.dir }} -s:h build_type=Release -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }} -pr:h ${{ inputs.compiler_profile }} --build=missing ${{ inputs.extra_conan_arguments }}
109113

110114
- name: 📡 Sign into Conan Package Repository
111115
if: ${{ inputs.version != 'latest' && inputs.remote_url != '' && env.CONAN_REMOTE_USER != '' && env.CONAN_REMOTE_PASSWORD != '' }}

.github/workflows/package_and_upload_all.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ on:
4747
type: string
4848
default: "5.x.y"
4949
description: "Git ref (branch, tag, or SHA) of libhal/ci to use for scripts"
50+
extra_conan_arguments:
51+
type: string
52+
default: ""
53+
description: "Extra arguments to pass to conan create commands"
5054

5155
secrets:
5256
conan_remote_password:
@@ -70,6 +74,7 @@ jobs:
7074
version: ${{ inputs.version }}
7175
dir: ${{ inputs.dir }}
7276
remote_url: ${{ inputs.remote_url }}
77+
extra_conan_arguments: ${{ inputs.extra_conan_arguments }}
7378
secrets:
7479
conan_remote_user: ${{ secrets.conan_remote_user }}
7580
conan_remote_password: ${{ secrets.conan_remote_password }}
@@ -89,6 +94,7 @@ jobs:
8994
version: ${{ inputs.version }}
9095
dir: ${{ inputs.dir }}
9196
remote_url: ${{ inputs.remote_url }}
97+
extra_conan_arguments: ${{ inputs.extra_conan_arguments }}
9298
secrets:
9399
conan_remote_user: ${{ secrets.conan_remote_user }}
94100
conan_remote_password: ${{ secrets.conan_remote_password }}
@@ -108,6 +114,7 @@ jobs:
108114
version: ${{ inputs.version }}
109115
dir: ${{ inputs.dir }}
110116
remote_url: ${{ inputs.remote_url }}
117+
extra_conan_arguments: ${{ inputs.extra_conan_arguments }}
111118
secrets:
112119
conan_remote_user: ${{ secrets.conan_remote_user }}
113120
conan_remote_password: ${{ secrets.conan_remote_password }}
@@ -154,7 +161,8 @@ jobs:
154161
--version ${{ inputs.version }} \
155162
--compiler-profile hal/tc/llvm \
156163
--conan-version ${{ inputs.conan_version }} \
157-
--arch-list cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85
164+
--arch-list cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85 \
165+
--extra-conan-args "${{ inputs.extra_conan_arguments }}"
158166
159167
- name: 📦 Build packages for all Cortex-M architectures
160168
working-directory: target-repo
@@ -165,7 +173,8 @@ jobs:
165173
--version ${{ inputs.version }} \
166174
--compiler-profile hal/tc/llvm \
167175
--conan-version ${{ inputs.conan_version }} \
168-
--arch-list cortex-m0,cortex-m0plus,cortex-m1,cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85
176+
--arch-list cortex-m0,cortex-m0plus,cortex-m1,cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85 \
177+
--extra-conan-args "${{ inputs.extra_conan_arguments }}"
169178
170179
- name: 📡 Add conan user remote-package-repo
171180
if: ${{ inputs.remote_url != '' }}
@@ -221,7 +230,8 @@ jobs:
221230
--version ${{ inputs.version }} \
222231
--compiler-profile hal/tc/arm-gcc \
223232
--conan-version ${{ inputs.conan_version }} \
224-
--arch-list cortex-m0,cortex-m0plus,cortex-m1,cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85
233+
--arch-list cortex-m0,cortex-m0plus,cortex-m1,cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85 \
234+
--extra-conan-args "${{ inputs.extra_conan_arguments }}"
225235
226236
- name: 📡 Add conan user remote-package-repo
227237
if: ${{ inputs.remote_url != '' }}

.github/workflows/self_check.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
- cron: "0 12 * * 0"
2424
workflow_dispatch:
2525

26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
2630
jobs:
2731
library_check_libhal_v4:
2832
uses: ./.github/workflows/library_check.yml
@@ -85,6 +89,7 @@ jobs:
8589
library: strong_ptr
8690
repo: libhal/strong_ptr
8791
modules_support_needed: true
92+
ci_ref: ${{ github.head_ref || github.ref_name }}
8893
secrets: inherit
8994

9095
package-libhal_v4:
@@ -93,6 +98,7 @@ jobs:
9398
library: libhal
9499
repo: libhal/libhal
95100
dir: v4
101+
ci_ref: ${{ github.head_ref || github.ref_name }}
96102
secrets: inherit
97103

98104
package-libhal-util:
@@ -101,6 +107,7 @@ jobs:
101107
library: libhal-util
102108
repo: libhal/libhal-util
103109
dir: v5
110+
ci_ref: ${{ github.head_ref || github.ref_name }}
104111
secrets: inherit
105112

106113
# TODO(#95): Enable Windows

scripts/baremetal_package.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ VERSION="latest"
1818
COMPILER_PROFILE="hal/tc/llvm"
1919
ARCH_LIST=("cortex-m3")
2020
CONAN_VERSION=2.23.0
21+
EXTRA_CONAN_ARGS=""
2122

2223
# Parse command line arguments
2324
while [[ $# -gt 0 ]]; do
@@ -42,9 +43,13 @@ while [[ $# -gt 0 ]]; do
4243
IFS=',' read -ra ARCH_LIST <<< "$2"
4344
shift 2
4445
;;
46+
--extra-conan-args)
47+
EXTRA_CONAN_ARGS="$2"
48+
shift 2
49+
;;
4550
*)
4651
echo "Unknown option: $1"
47-
echo "Usage: $0 [--dir DIR] [--version VERSION] [--compiler-profile PROFILE] [--conan-version VERSION] [--arch-list ARCH1,ARCH2,...]"
52+
echo "Usage: $0 [--dir DIR] [--version VERSION] [--compiler-profile PROFILE] [--conan-version VERSION] [--arch-list ARCH1,ARCH2,...] [--extra-conan-args ARGS]"
4853
exit 1
4954
;;
5055
esac
@@ -59,9 +64,9 @@ conan hal setup
5964
for ARCH in "${ARCH_LIST[@]}"; do
6065
echo "Building for architecture: $ARCH"
6166

62-
conan create $DIR -s:h build_type=Debug -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing
67+
conan create $DIR -s:h build_type=Debug -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing $EXTRA_CONAN_ARGS
6368

64-
conan create $DIR -s:h build_type=MinSizeRel -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing
69+
conan create $DIR -s:h build_type=MinSizeRel -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing $EXTRA_CONAN_ARGS
6570

66-
conan create $DIR -s:h build_type=Release -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing
67-
done
71+
conan create $DIR -s:h build_type=Release -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing $EXTRA_CONAN_ARGS
72+
done

0 commit comments

Comments
 (0)