Skip to content

Commit 6f9541e

Browse files
committed
ENH: Transition package build test GHA to modern remote infrastructure
Transition package build test GHA to modern remote infrastructure: adopt the `ITKRemoteModuleBuildTestPackageAction` action to avoid boilerplate code. Bump ITK version to 5.4.0 in CI. The package already required ITK 5.4.*.
1 parent 0c55716 commit 6f9541e

File tree

1 file changed

+6
-275
lines changed

1 file changed

+6
-275
lines changed

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

+6-275
Original file line numberDiff line numberDiff line change
@@ -3,279 +3,10 @@ name: Build, test, package
33
on: [push,pull_request]
44

55
jobs:
6-
build-test-cxx:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
max-parallel: 3
10-
matrix:
11-
os: [ubuntu-18.04, windows-2019, macos-10.15]
12-
include:
13-
- os: ubuntu-18.04
14-
c-compiler: "gcc"
15-
cxx-compiler: "g++"
16-
itk-git-tag: "v5.3rc03"
17-
cmake-build-type: "MinSizeRel"
18-
- os: windows-2019
19-
c-compiler: "cl.exe"
20-
cxx-compiler: "cl.exe"
21-
itk-git-tag: "v5.3rc03"
22-
cmake-build-type: "Release"
23-
- os: macos-10.15
24-
c-compiler: "clang"
25-
cxx-compiler: "clang++"
26-
itk-git-tag: "v5.3rc03"
27-
cmake-build-type: "MinSizeRel"
6+
cxx-build-workflow:
7+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
288

29-
steps:
30-
- uses: actions/checkout@v2
31-
32-
- name: Set up Python 3.8
33-
uses: actions/setup-python@v2
34-
with:
35-
python-version: 3.8
36-
37-
- name: Install build dependencies
38-
run: |
39-
python -m pip install --upgrade pip
40-
python -m pip install ninja
41-
42-
- name: Get specific version of CMake, Ninja
43-
uses: lukka/[email protected]
44-
45-
- name: Download ITK
46-
run: |
47-
cd ..
48-
git clone https://github.com/InsightSoftwareConsortium/ITK.git
49-
cd ITK
50-
git checkout ${{ matrix.itk-git-tag }}
51-
52-
- name: Build ITK
53-
if: matrix.os != 'windows-2019'
54-
run: |
55-
cd ..
56-
mkdir ITK-build
57-
cd ITK-build
58-
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
59-
ninja
60-
61-
- name: Build ITK
62-
if: matrix.os == 'windows-2019'
63-
run: |
64-
cd ..
65-
mkdir ITK-build
66-
cd ITK-build
67-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
68-
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
69-
ninja
70-
shell: cmd
71-
72-
- name: Fetch CTest driver script
73-
run: |
74-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
75-
76-
- name: Configure CTest script
77-
shell: bash
78-
run: |
79-
operating_system="${{ matrix.os }}"
80-
cat > dashboard.cmake << EOF
81-
set(CTEST_SITE "GitHubActions")
82-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/.." CTEST_DASHBOARD_ROOT)
83-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/" CTEST_SOURCE_DIRECTORY)
84-
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../build" CTEST_BINARY_DIRECTORY)
85-
set(dashboard_source_name "${GITHUB_REPOSITORY}")
86-
if(ENV{GITHUB_REF} MATCHES "master")
87-
set(branch "-master")
88-
set(dashboard_model "Continuous")
89-
else()
90-
set(branch "-${GITHUB_REF}")
91-
set(dashboard_model "Experimental")
92-
endif()
93-
set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}")
94-
set(CTEST_UPDATE_VERSION_ONLY 1)
95-
set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL})
96-
set(CTEST_BUILD_CONFIGURATION "Release")
97-
set(CTEST_CMAKE_GENERATOR "Ninja")
98-
set(CTEST_CUSTOM_WARNING_EXCEPTION
99-
\${CTEST_CUSTOM_WARNING_EXCEPTION}
100-
# macOS Azure VM Warning
101-
"ld: warning: text-based stub file"
102-
)
103-
set(dashboard_no_clean 1)
104-
set(ENV{CC} ${{ matrix.c-compiler }})
105-
set(ENV{CXX} ${{ matrix.cxx-compiler }})
106-
if(WIN32)
107-
set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}")
108-
endif()
109-
set(dashboard_cache "
110-
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build
111-
BUILD_TESTING:BOOL=ON
112-
")
113-
string(TIMESTAMP build_date "%Y-%m-%d")
114-
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
115-
message("CTEST_SITE = \${CTEST_SITE}")
116-
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
117-
EOF
118-
cat dashboard.cmake
119-
120-
- name: Build and test
121-
if: matrix.os != 'windows-2019'
122-
run: |
123-
ctest --output-on-failure -j 2 -V -S dashboard.cmake
124-
125-
- name: Build and test
126-
if: matrix.os == 'windows-2019'
127-
run: |
128-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
129-
ctest --output-on-failure -j 2 -V -S dashboard.cmake
130-
shell: cmd
131-
132-
build-linux-python-packages:
133-
runs-on: ubuntu-20.04
134-
strategy:
135-
max-parallel: 2
136-
matrix:
137-
python-version: [37, 38, 39]
138-
include:
139-
- itk-python-git-tag: "v5.3rc03"
140-
141-
steps:
142-
- uses: actions/checkout@v2
143-
144-
- name: 'Free up disk space'
145-
run: |
146-
# Workaround for https://github.com/actions/virtual-environments/issues/709
147-
df -h
148-
sudo apt-get clean
149-
sudo rm -rf "/usr/local/share/boost"
150-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
151-
df -h
152-
153-
- name: 'Fetch build script'
154-
run: |
155-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
156-
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
157-
158-
- name: 'Build 🐍 Python 📦 package'
159-
run: |
160-
export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }}
161-
./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }}
162-
163-
- name: Publish Python package as GitHub Artifact
164-
uses: actions/upload-artifact@v1
165-
with:
166-
name: LinuxWheel${{ matrix.python-version }}
167-
path: dist
168-
169-
build-macos-python-packages:
170-
runs-on: macos-10.15
171-
strategy:
172-
max-parallel: 2
173-
matrix:
174-
include:
175-
- itk-python-git-tag: "v5.3rc03"
176-
177-
steps:
178-
- uses: actions/checkout@v2
179-
180-
- name: 'Specific XCode version'
181-
run: |
182-
sudo xcode-select -s "/Applications/Xcode_11.7.app"
183-
184-
- name: Get specific version of CMake, Ninja
185-
uses: lukka/[email protected]
186-
187-
- name: 'Fetch build script'
188-
run: |
189-
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O
190-
chmod u+x macpython-download-cache-and-build-module-wheels.sh
191-
192-
- name: 'Build 🐍 Python 📦 package'
193-
run: |
194-
export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }}
195-
export MACOSX_DEPLOYMENT_TARGET=10.9
196-
./macpython-download-cache-and-build-module-wheels.sh
197-
198-
- name: Publish Python package as GitHub Artifact
199-
uses: actions/upload-artifact@v1
200-
with:
201-
name: MacOSWheels
202-
path: dist
203-
204-
build-windows-python-packages:
205-
runs-on: windows-2019
206-
strategy:
207-
max-parallel: 2
208-
matrix:
209-
python-version-minor: [7, 8, 9]
210-
include:
211-
- itk-python-git-tag: "v5.3rc03"
212-
213-
steps:
214-
- name: Get specific version of CMake, Ninja
215-
uses: lukka/[email protected]
216-
217-
- uses: actions/checkout@v2
218-
with:
219-
path: "im"
220-
221-
- name: 'Install Python'
222-
run: |
223-
$pythonArch = "64"
224-
$pythonVersion = "3.${{ matrix.python-version-minor }}"
225-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
226-
227-
- name: 'Fetch build dependencies'
228-
shell: bash
229-
run: |
230-
mv im ../../
231-
cd ../../im
232-
curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ matrix.itk-python-git-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip"
233-
7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r
234-
curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip"
235-
7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r
236-
curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip"
237-
7z x grep-win.zip -o/c/P/grep -aoa -r
238-
239-
- name: 'Build 🐍 Python 📦 package'
240-
shell: cmd
241-
run: |
242-
cd ../../im
243-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
244-
set PATH="C:\P\grep;%PATH%"
245-
set CC=cl.exe
246-
set CXX=cl.exe
247-
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" --no-cleanup
248-
249-
- name: Publish Python package as GitHub Artifact
250-
uses: actions/upload-artifact@v1
251-
with:
252-
name: WindowsWheel3.${{ matrix.python-version-minor }}
253-
path: ../../im/dist
254-
255-
publish-python-packages-to-pypi:
256-
needs:
257-
- build-linux-python-packages
258-
- build-macos-python-packages
259-
- build-windows-python-packages
260-
runs-on: ubuntu-18.04
261-
262-
steps:
263-
- name: Download Python Packages
264-
uses: actions/download-artifact@v2
265-
266-
- name: Prepare packages for upload
267-
run: |
268-
ls -R
269-
for d in */; do
270-
mv ${d}/*.whl .
271-
done
272-
mkdir dist
273-
mv *.whl dist/
274-
ls dist
275-
276-
- name: Publish 🐍 Python 📦 package to PyPI
277-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
278-
uses: pypa/gh-action-pypi-publish@master
279-
with:
280-
user: __token__
281-
password: ${{ secrets.pypi_password }}
9+
python-build-workflow:
10+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
11+
secrets:
12+
pypi_password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)