Skip to content

Commit 92fb91c

Browse files
committed
ENH: Incorporate GitHub Actions from ITKModuleTemplate This requires the incorporation of 2 yml scripts that will test the module under various configurations for Windows, Linux and MacOS. These scripts were copied from the ITKModuleTemplate.
1 parent 9055b25 commit 92fb91c

File tree

3 files changed

+283
-0
lines changed

3 files changed

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

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ITKFixedPointInverseDisplacementField
22
=================================
3+
.. image:: https://github.com/InsightSoftwareConsortium/ITKFixedPointInverseDisplacementField/workflows/Build,%20test,%20package/badge.svg
34

45
.. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKFixedPointInverseDisplacementField.svg?style=shield
56
:target: https://circleci.com/gh/InsightSoftwareConsortium/ITKFixedPointInverseDisplacementField

0 commit comments

Comments
 (0)