Skip to content

Commit b928314

Browse files
author
Simon Rit
committed
ENH: GHA: Use ITKRemoteModuleBuildTestPackageAction build-test-package.yml
1 parent bcf2ea4 commit b928314

File tree

1 file changed

+19
-340
lines changed

1 file changed

+19
-340
lines changed

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

Lines changed: 19 additions & 340 deletions
Original file line numberDiff line numberDiff line change
@@ -8,350 +8,29 @@ on:
88
branches:
99
- main
1010

11-
env:
12-
# v6.0a02
13-
itk-git-tag: "v6.0a02"
14-
itk-wheel-tag: "v6.0a02"
15-
# v6.0a02 + fixes
16-
itk-python-package-tag: "v6.0a02"
17-
itk-python-package-org: "InsightSoftwareConsortium"
11+
concurrency:
12+
group: '${{ github.workflow }}@${{ github.head_ref || github.run_id }}'
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1814

1915
jobs:
20-
build-test-cxx:
21-
runs-on: ${{ matrix.os }}
22-
strategy:
23-
max-parallel: 3
24-
matrix:
25-
# runners macos-13 is x86_64, macos-15 is arm64 by default
26-
os: [ubuntu-24.04, windows-2022, macos-13, macos-15]
27-
include:
28-
- os: ubuntu-24.04
29-
c-compiler: "gcc"
30-
cxx-compiler: "g++"
31-
cmake-build-type: "MinSizeRel"
32-
- os: windows-2022
33-
c-compiler: "cl.exe"
34-
cxx-compiler: "cl.exe"
35-
cmake-build-type: "Release"
36-
- os: macos-13
37-
c-compiler: "clang"
38-
cxx-compiler: "clang++"
39-
cmake-build-type: "MinSizeRel"
40-
deployment_target: '10.9'
41-
- os: macos-15
42-
c-compiler: "clang"
43-
cxx-compiler: "clang++"
44-
cmake-build-type: "MinSizeRel"
45-
deployment_target: '13.0'
46-
47-
steps:
48-
- uses: actions/[email protected]
49-
50-
- name: Free Disk Space (Ubuntu)
51-
if: matrix.os == 'ubuntu-24.04'
52-
uses: jlumbroso/[email protected]
53-
with:
54-
large-packages: false
55-
56-
- name: Set up Python 3.11
57-
uses: actions/[email protected]
58-
with:
59-
python-version: "3.11"
60-
61-
- name: Install build dependencies
62-
run: |
63-
python -m pip install --upgrade pip
64-
python -m pip install ninja
65-
python -m pip install cookiecutter
66-
67-
- name: Get specific version of CMake, Ninja
68-
uses: lukka/[email protected]
69-
70-
- name: 'Specific XCode version 14.3.1'
71-
if: matrix.os == 'macos-13'
72-
run: |
73-
sudo xcode-select -s "/Applications/Xcode_14.3.1.app"
74-
75-
- name: 'Specific XCode version 16.2'
76-
if: matrix.os == 'macos-15'
77-
run: |
78-
sudo xcode-select -s "/Applications/Xcode_16.2.app"
79-
80-
- name: Download ITK
81-
run: |
82-
cd ..
83-
git clone https://github.com/InsightSoftwareConsortium/ITK.git
84-
cd ITK
85-
git checkout ${{ env.itk-git-tag }}
86-
87-
- name: Build ITK
88-
if: matrix.os != 'windows-2022'
89-
shell: bash
90-
run: |
91-
cd ..
92-
mkdir ITK-build
93-
cd ITK-build
94-
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
95-
ninja
96-
97-
- name: Build ITK
98-
if: matrix.os == 'windows-2022'
99-
shell: pwsh
100-
run: |
101-
Set-PSDebug -Trace 1
102-
cd ..
103-
mkdir ITK-build
104-
cd ITK-build
105-
& "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation
106-
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
107-
ninja
108-
109-
- name: Fetch CTest driver script
110-
run: |
111-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
112-
113-
- name: Evaluate template
114-
shell: bash
115-
run: |
116-
python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/../Evaluated" "${GITHUB_WORKSPACE}"
117-
mkdir "${GITHUB_WORKSPACE}/../Evaluated/ITKModuleTemplate/.git"
118-
119-
- name: Configure CTest script
120-
shell: bash
121-
run: |
122-
operating_system="${{ matrix.os }}"
123-
cat > dashboard.cmake << EOF
124-
set(CTEST_SITE "GitHubActions")
125-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/.." CTEST_DASHBOARD_ROOT)
126-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../Evaluated/ITKModuleTemplate" CTEST_SOURCE_DIRECTORY)
127-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../build" CTEST_BINARY_DIRECTORY)
128-
set(dashboard_source_name "${GITHUB_REPOSITORY}")
129-
if(ENV{GITHUB_REF} MATCHES "main")
130-
set(branch "-main")
131-
set(dashboard_model "Continuous")
132-
else()
133-
set(branch "-${GITHUB_REF}")
134-
set(dashboard_model "Experimental")
135-
endif()
136-
set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}")
137-
set(CTEST_UPDATE_VERSION_ONLY 1)
138-
set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL})
139-
set(CTEST_BUILD_CONFIGURATION "Release")
140-
set(CTEST_CMAKE_GENERATOR "Ninja")
141-
set(CTEST_CUSTOM_WARNING_EXCEPTION
142-
\${CTEST_CUSTOM_WARNING_EXCEPTION}
143-
# macOS Azure VM Warning
144-
"ld: warning: text-based stub file"
145-
)
146-
set(dashboard_no_clean 1)
147-
set(ENV{CC} ${{ matrix.c-compiler }})
148-
set(ENV{CXX} ${{ matrix.cxx-compiler }})
149-
if(WIN32)
150-
set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}")
151-
endif()
152-
set(dashboard_cache "
153-
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build
154-
BUILD_TESTING:BOOL=ON
155-
")
156-
string(TIMESTAMP build_date "%Y-%m-%d")
157-
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
158-
message("CTEST_SITE = \${CTEST_SITE}")
159-
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
160-
EOF
161-
cat dashboard.cmake
162-
163-
- name: Build and test
164-
if: matrix.os != 'windows-2022'
165-
run: |
166-
ctest --output-on-failure -j 2 -V -S dashboard.cmake
167-
168-
- name: Build and test
169-
if: matrix.os == 'windows-2022'
170-
shell: pwsh
171-
run: |
172-
& "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation
173-
ctest --output-on-failure -j 2 -V -S dashboard.cmake
174-
175-
build-linux-python-packages:
176-
runs-on: ubuntu-24.04
177-
strategy:
178-
max-parallel: 2
179-
matrix:
180-
python-version: ["39", "310", "311","312","313"]
181-
182-
steps:
183-
- uses: actions/[email protected]
184-
185-
- name: 'Free up disk space'
186-
run: |
187-
# Workaround for https://github.com/actions/virtual-environments/issues/709
188-
df -h
189-
sudo apt-get clean
190-
sudo rm -rf "/usr/local/share/boost"
191-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
192-
df -h
193-
194-
- name: 'Fetch build dependencies'
195-
shell: bash
196-
run: |
197-
sudo apt install zstd
198-
unzstd --version
199-
200-
- name: Set up Python 3.11
201-
uses: actions/[email protected]
202-
with:
203-
python-version: "3.11"
204-
205-
- name: Get specific version of CMake, Ninja
206-
uses: lukka/[email protected]
207-
208-
- name: Evaluate template
209-
shell: bash
210-
run: |
211-
python -m pip install cookiecutter
212-
python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}"
213-
mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git"
214-
215-
- name: 'Fetch build script'
216-
run: |
217-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/${{ env.itk-python-package-tag }}/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
218-
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
219-
220-
- name: 'Build 🐍 Python 📦 package'
221-
run: |
222-
cd "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate"
223-
export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }}
224-
export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }}
225-
for manylinux_version in "_2_28" "2014"; do
226-
rm -rf ITKPythonPackage
227-
export MANYLINUX_VERSION=${manylinux_version}
228-
echo "Building for manylinux specialization ${MANYLINUX_VERSION}"
229-
../../dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }}
230-
done
231-
232-
- name: Publish Python package as GitHub Artifact
233-
uses: actions/[email protected]
234-
with:
235-
name: LinuxWheel3${{ matrix.python-version }}
236-
path: Evaluated/ITKModuleTemplate/dist
237-
238-
build-macos-python-packages:
239-
runs-on: macos-13
240-
strategy:
241-
max-parallel: 2
242-
matrix:
243-
python3-minor-version: ["9", "10", "11", "12", "13"]
244-
245-
steps:
246-
- uses: actions/[email protected]
247-
248-
- name: 'Specific XCode version'
249-
run: |
250-
sudo xcode-select -s "/Applications/Xcode_14.3.1.app"
251-
252-
- name: Get specific version of CMake, Ninja
253-
uses: lukka/[email protected]
254-
255-
- name: 'Fetch build script'
256-
run: |
257-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/${{ env.itk-python-package-tag }}/scripts/macpython-download-cache-and-build-module-wheels.sh -O
258-
chmod u+x macpython-download-cache-and-build-module-wheels.sh
259-
260-
- name: Set up Python 3.11
261-
uses: actions/[email protected]
262-
with:
263-
python-version: "3.11"
264-
265-
- name: Evaluate template
266-
shell: bash
267-
run: |
268-
python -m pip install cookiecutter
269-
python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}"
270-
mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git"
271-
272-
- name: 'Build 🐍 Python 📦 package'
273-
run: |
274-
cd "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate"
275-
export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }}
276-
export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }}
277-
export ITKPYTHONPACKAGE_ORG=${{ env.itk-python-package-org }}
278-
# For Xcode 16.2, the recommended "MACOSX_DEPLOYMENT_TARGET" is "13.0"; this means your application should be built to run on macOS Ventura (version 13.0) or later.
279-
export MACOSX_DEPLOYMENT_TARGET=${{ matrix.deployment_target || '13.0' }}
280-
../../macpython-download-cache-and-build-module-wheels.sh "3.${{ matrix.python3-minor-version }}"
281-
282-
- name: Publish Python package as GitHub Artifact
283-
uses: actions/[email protected]
284-
with:
285-
name: MacOSWheel3${{ matrix.python3-minor-version }}
286-
path: Evaluated/ITKModuleTemplate/dist
287-
288-
build-windows-python-packages:
289-
runs-on: windows-2022
290-
strategy:
291-
max-parallel: 2
292-
matrix:
293-
python-version-minor: ["9", "10", "11"]
294-
16+
cookie-cutter-workflow:
29517
steps:
296-
- uses: actions/[email protected]
297-
298-
- name: 'Install Python'
299-
run: |
300-
$pythonArch = "64"
301-
$pythonVersion = "3.${{ matrix.python-version-minor }}"
302-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
303-
304-
- uses: actions/[email protected]
305-
with:
306-
python-version: '3.x'
307-
308-
- name: Get specific version of CMake, Ninja
309-
uses: lukka/[email protected]
310-
311-
- name: Set up Python 3.11/
312-
uses: actions/[email protected]
313-
with:
314-
python-version: "3.11"
315-
31618
- name: Evaluate template
31719
shell: bash
31820
run: |
31921
python -m pip install cookiecutter
320-
python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}"
321-
mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git"
322-
323-
- name: 'Fetch build dependencies'
324-
shell: bash
325-
run: |
326-
cd Evaluated/ITKModuleTemplate
327-
curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ env.itk-wheel-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip"
328-
7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r
329-
curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip"
330-
7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r
331-
curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip"
332-
7z x grep-win.zip -o/c/P/grep -aoa -r
333-
334-
# Update step for skbuild issue in v5.3.0 build archive
335-
echo "Updating ITKPythonPackage build scripts to ${{ env.itk-python-package-tag }}"
336-
pushd /c/P/IPP
337-
git remote add InsightSoftwareConsortium https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git --tags
338-
git fetch InsightSoftwareConsortium
339-
git checkout ${{ env.itk-python-package-tag }}
340-
git status
341-
popd
342-
343-
- name: 'Build 🐍 Python 📦 package'
344-
shell: cmd
345-
run: |
346-
cd Evaluated/ITKModuleTemplate
347-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
348-
set PATH=C:\P\grep;%PATH%
349-
set CC=cl.exe
350-
set CXX=cl.exe
351-
C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64"
352-
353-
- name: Publish Python package as GitHub Artifact
354-
uses: actions/[email protected]
355-
with:
356-
name: WindowsWheel3.${{ matrix.python-version-minor }}
357-
path: Evaluated/ITKModuleTemplate/dist
22+
cd "${GITHUB_WORKSPACE}"
23+
python -m cookiecutter --no-input --output-dir Evaluated .
24+
mv Evaluated/ITKModuleTemplate/* .
25+
26+
cxx-build-workflow:
27+
needs:
28+
- cookie-cutter-workflow
29+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
30+
31+
python-build-workflow:
32+
needs:
33+
- cookie-cutter-workflow
34+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
35+
secrets:
36+
pypi_password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)