Skip to content

Commit 3730f9b

Browse files
hjmjohnsonclaude
andcommitted
ENH: Add platform-specific package install inputs and OS selection
Add optional inputs to the CXX build workflow: - apt-packages: Install system packages on Linux (apt-get) - brew-packages: Install system packages on macOS (brew) - choco-packages: Install system packages on Windows (choco) - os-list: JSON array of runner OS labels to build on, allowing modules to disable platforms that cannot work Update README with: - Simplified example using secrets: inherit instead of explicit secrets block (avoids YAML errors from empty secrets:) - Example for modules with external system dependencies - Updated workflow ref from @main to @v5.4.6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9669cfe commit 3730f9b

File tree

2 files changed

+63
-6
lines changed

2 files changed

+63
-6
lines changed

.github/workflows/build-test-cxx.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,31 @@ on:
3030
# example: MeshToPolyData@3ad8f08:BSplineGradient@0.3.0
3131
required: false
3232
type: string
33+
apt-packages:
34+
description: 'Space-separated list of apt packages to install on Linux runners before building (e.g. libopenslide-dev libfftw3-dev)'
35+
required: false
36+
type: string
37+
brew-packages:
38+
description: 'Space-separated list of Homebrew packages to install on macOS runners before building (e.g. openslide libomp)'
39+
required: false
40+
type: string
41+
choco-packages:
42+
description: 'Space-separated list of Chocolatey packages to install on Windows runners before building'
43+
required: false
44+
type: string
45+
os-list:
46+
description: 'JSON-formatted array of runner OS labels to build on (default: all platforms)'
47+
required: false
48+
type: string
49+
default: '["ubuntu-22.04", "windows-2022", "macos-15-intel", "macos-15"]'
3350

3451
jobs:
3552
build-test-cxx:
3653
runs-on: ${{ matrix.os }}
3754
strategy:
3855
max-parallel: 3
3956
matrix:
40-
os: [ubuntu-22.04, windows-2022, macos-15-intel, macos-15]
57+
os: ${{ fromJSON(inputs.os-list) }}
4158
include:
4259
- os: ubuntu-22.04
4360
c-compiler: "gcc"
@@ -65,6 +82,22 @@ jobs:
6582
with:
6683
large-packages: false
6784

85+
- name: Install system packages (Linux)
86+
if: inputs.apt-packages != '' && runner.os == 'Linux'
87+
run: |
88+
sudo apt-get update -qq
89+
sudo apt-get install -y -qq ${{ inputs.apt-packages }}
90+
91+
- name: Install system packages (macOS)
92+
if: inputs.brew-packages != '' && runner.os == 'macOS'
93+
run: |
94+
brew install ${{ inputs.brew-packages }}
95+
96+
- name: Install system packages (Windows)
97+
if: inputs.choco-packages != '' && runner.os == 'Windows'
98+
run: |
99+
choco install -y ${{ inputs.choco-packages }}
100+
68101
- name: Set up Python 3.11
69102
uses: actions/setup-python@v5
70103
with:

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,38 @@ on: [push,pull_request]
8787

8888
jobs:
8989
cxx-build-workflow:
90-
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@main
90+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@v5.4.6
91+
92+
python-build-workflow:
93+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.6
94+
secrets: inherit
95+
```
96+
97+
> **Note:** `secrets: inherit` passes all repository secrets (including `pypi_password`)
98+
> to the reusable workflow. This is simpler than explicitly listing each secret and avoids
99+
> YAML errors from empty `secrets:` blocks. Alternatively, you can pass secrets explicitly:
100+
> ```yaml
101+
> secrets:
102+
> pypi_password: ${{ secrets.pypi_password }}
103+
> ```
104+
105+
#### Modules with external system dependencies
106+
107+
Modules that require system libraries not available on standard runners can use
108+
the `apt-packages`, `brew-packages`, `choco-packages`, and `os-list` inputs:
109+
110+
```yaml
111+
jobs:
112+
cxx-build-workflow:
113+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@v5.4.6
91114
with:
92-
itk-cmake-options: '-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF -DITKGroup_Core:BOOL=ON'
115+
apt-packages: 'libopenslide-dev'
116+
brew-packages: 'openslide'
117+
os-list: '["ubuntu-22.04", "macos-15-intel", "macos-15"]'
93118
94119
python-build-workflow:
95-
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@main
96-
secrets:
97-
pypi_password: ${{ secrets.pypi_password }}
120+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.6
121+
secrets: inherit
98122
```
99123

100124
The example above can be broken down line by line:

0 commit comments

Comments
 (0)