Skip to content

Commit e771184

Browse files
mseng10dzenanz
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 3b71d6e commit e771184

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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+
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
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

0 commit comments

Comments
 (0)