Skip to content

Commit c533b8b

Browse files
authored
Merge pull request #82 from InsightSoftwareConsortium/github-actions-build-test-package
GitHub actions build test package
2 parents e734286 + 6563eec commit c533b8b

File tree

4 files changed

+540
-7
lines changed

4 files changed

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

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ITKModuleTemplate
22
=================
33

4-
[![Build Status](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_apis/build/status/InsightSoftwareConsortium.ITKModuleTemplate?branchName=master)](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_build/latest?definitionId=19&branchName=master)
4+
![](https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/workflows/Build,%20test,%20package/badge.svg)
55

66
Overview
77
--------
@@ -97,14 +97,15 @@ followlowing contents:
9797
GIT_TAG abcdef012345
9898
)
9999

100-
Python Packages
101-
---------------
100+
CI Testing and Python Packages
101+
------------------------------
102102

103103
Continuous integration service configurations are included to build
104+
and test the C++ core of packages across platforms and build binary
104105
Python packages for Linux, macOS, and Windows. These packages can be
105-
[downloaded](https://itkpythonpackage.readthedocs.io/en/latest/Build_ITK_Module_Python_packages.html#github-automated-ci-package-builds)
106+
[downloaded](https://itkpythonpackage.readthedocs.io/en/master/Build_ITK_Module_Python_packages.html#github-automated-ci-package-builds)
106107
and [uploaded to the Python Package Index
107-
(PyPI)](https://itkpythonpackage.readthedocs.io/en/latest/Build_ITK_Module_Python_packages.html#upload-the-packages-to-pypi).
108+
(PyPI)](https://itkpythonpackage.readthedocs.io/en/master/Build_ITK_Module_Python_packages.html#upload-the-packages-to-pypi).
108109

109110
ITKv4 Branch
110111
------------

0 commit comments

Comments
 (0)