Skip to content

Commit 47650d6

Browse files
mseng10hjmjohnson
authored andcommitted
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. Also, the README was updated.
1 parent 2e2b737 commit 47650d6

File tree

3 files changed

+282
-0
lines changed

3 files changed

+282
-0
lines changed
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
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+
- name: Build ITK
50+
if: matrix.os != 'windows-2019'
51+
run: |
52+
cd ..
53+
mkdir ITK-build
54+
cd ITK-build
55+
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
56+
ninja
57+
58+
- name: Build ITK
59+
if: matrix.os == 'windows-2019'
60+
run: |
61+
cd ..
62+
mkdir ITK-build
63+
cd ITK-build
64+
echo %cd%
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+
set(dashboard_cache "
105+
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build
106+
BUILD_TESTING:BOOL=ON
107+
")
108+
string(TIMESTAMP build_date "%Y-%m-%d")
109+
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
110+
message("CTEST_SITE = \${CTEST_SITE}")
111+
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
112+
EOF
113+
cat dashboard.cmake
114+
115+
- name: Build and test
116+
if: matrix.os != 'windows-2019'
117+
run: |
118+
ctest --output-on-failure -j 2 -V -S dashboard.cmake
119+
120+
- name: Build and test
121+
if: matrix.os == 'windows-2019'
122+
run: |
123+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
124+
ctest --output-on-failure -j 2 -V -S dashboard.cmake
125+
shell: cmd
126+
127+
#TODO: Fix Python wrapping errors and uncomment python package testing
128+
# build-linux-python-packages:
129+
# runs-on: ubuntu-18.04
130+
# strategy:
131+
# max-parallel: 2
132+
# matrix:
133+
# python-version: [35, 36, 37, 38]
134+
# include:
135+
# - itk-python-git-tag: "v5.1.1"
136+
#
137+
# steps:
138+
# - uses: actions/checkout@v2
139+
#
140+
# - name: 'Free up disk space'
141+
# run: |
142+
# # Workaround for https://github.com/actions/virtual-environments/issues/709
143+
# df -h
144+
# sudo apt-get clean
145+
# sudo rm -rf "/usr/local/share/boost"
146+
# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
147+
# df -h
148+
#
149+
# - name: 'Fetch build script'
150+
# run: |
151+
# curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
152+
# chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
153+
#
154+
# - name: 'Build 🐍 Python 📦 package'
155+
# run: |
156+
# export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }}
157+
# ./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }}
158+
#
159+
# - name: Publish Python package as GitHub Artifact
160+
# uses: actions/upload-artifact@v1
161+
# with:
162+
# name: LinuxWheel${{ matrix.python-version }}
163+
# path: dist
164+
#
165+
# build-macos-python-packages:
166+
# runs-on: macos-10.15
167+
# strategy:
168+
# max-parallel: 2
169+
# matrix:
170+
# include:
171+
# - itk-python-git-tag: "v5.1.1"
172+
#
173+
# steps:
174+
# - uses: actions/checkout@v2
175+
#
176+
# - name: 'Fetch build script'
177+
# run: |
178+
# curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O
179+
# chmod u+x macpython-download-cache-and-build-module-wheels.sh
180+
#
181+
# - name: 'Build 🐍 Python 📦 package'
182+
# run: |
183+
# export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }}
184+
# export MACOSX_DEPLOYMENT_TARGET=10.9
185+
# ./macpython-download-cache-and-build-module-wheels.sh
186+
#
187+
# - name: Publish Python package as GitHub Artifact
188+
# uses: actions/upload-artifact@v1
189+
# with:
190+
# name: MacOSWheels
191+
# path: dist
192+
#
193+
# build-windows-python-packages:
194+
# runs-on: windows-2019
195+
# strategy:
196+
# max-parallel: 2
197+
# matrix:
198+
# python-version-minor: [5, 6, 7, 8]
199+
# include:
200+
# - itk-python-git-tag: "v5.1.1"
201+
#
202+
# steps:
203+
# - uses: actions/checkout@v2
204+
# with:
205+
# path: "im"
206+
#
207+
# - name: 'Install Python'
208+
# run: |
209+
# $pythonArch = "64"
210+
# $pythonVersion = "3.${{ matrix.python-version-minor }}"
211+
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
212+
#
213+
# - name: 'Fetch build dependencies'
214+
# shell: bash
215+
# run: |
216+
# mv im ../../
217+
# cd ../../
218+
# curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ matrix.itk-python-git-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip"
219+
# 7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r
220+
# curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip"
221+
# 7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r
222+
# curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip"
223+
# 7z x grep-win.zip -o/c/P/grep -aoa -r
224+
#
225+
# - name: 'Build 🐍 Python 📦 package'
226+
# shell: cmd
227+
# run: |
228+
# cd ../../im
229+
# call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
230+
# set PATH="C:\P\grep;%PATH%"
231+
# set CC=cl.exe
232+
# set CXX=cl.exe
233+
# 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"
234+
#
235+
# - name: Publish Python package as GitHub Artifact
236+
# uses: actions/upload-artifact@v1
237+
# with:
238+
# name: WindowWheel3.${{ matrix.python-version-minor }}
239+
# path: ../../im/dist
240+
#
241+
# publish-python-packages-to-pypi:
242+
# needs:
243+
# - build-linux-python-packages
244+
# - build-macos-python-packages
245+
# - build-windows-python-packages
246+
# runs-on: ubuntu-18.04
247+
#
248+
# steps:
249+
# - name: Download Python Packages
250+
# uses: actions/download-artifact@v2
251+
#
252+
# - name: Prepare packages for upload
253+
# run: |
254+
# ls -R
255+
# for d in */; do
256+
# mv ${d}/*.whl .
257+
# done
258+
# mkdir dist
259+
# mv *.whl dist/
260+
# ls dist
261+
#
262+
# - name: Publish 🐍 Python 📦 package to PyPI
263+
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
264+
# uses: pypa/gh-action-pypi-publish@master
265+
# with:
266+
# user: __token__
267+
# 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
ITKIsotropicWavelets
22
=================================
33

4+
.. image:: https://github.com/InsightSoftwareConsortium/ITKIsotropicWavelets/workflows/Build,%20test,%20package/badge.svg
5+
46
.. image:: https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_apis/build/status/InsightSoftwareConsortium.ITKIsotropicWavelets?branchName=master
57
:target: https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_build/latest?definitionId=5&branchName=master
68
:alt: Build Status

0 commit comments

Comments
 (0)