Skip to content

Commit 99fc57f

Browse files
committed
WIP: Test reusable workflow with multiple runners
1 parent a6f55fb commit 99fc57f

File tree

1 file changed

+186
-0
lines changed

1 file changed

+186
-0
lines changed
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
name: 'Build, Test, Package ITK Remote Module'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cmake-options:
7+
required: false
8+
type: string
9+
itk-cmake-options:
10+
required: false
11+
type: string
12+
itk-git-tag:
13+
required: false
14+
type: string
15+
default: '835dc01388d22c4b4c9a46b01dbdfe394ec23511'
16+
itk-wheel-tag:
17+
required: false
18+
type: string
19+
default: 'v5.3rc04.post2'
20+
21+
jobs:
22+
build-test-cxx:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
max-parallel: 3
26+
matrix:
27+
os: [ubuntu-20.04, windows-2019, macos-10.15]
28+
include:
29+
- os: ubuntu-20.04
30+
c-compiler: "gcc"
31+
cxx-compiler: "g++"
32+
cmake-build-type: "MinSizeRel"
33+
- os: windows-2019
34+
c-compiler: "cl.exe"
35+
cxx-compiler: "cl.exe"
36+
cmake-build-type: "Release"
37+
- os: macos-10.15
38+
c-compiler: "clang"
39+
cxx-compiler: "clang++"
40+
cmake-build-type: "MinSizeRel"
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Set up Python 3.8
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: 3.8
49+
50+
- name: Install build dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
python -m pip install ninja
54+
55+
- name: Get specific version of CMake, Ninja
56+
uses: lukka/[email protected]
57+
58+
- name: Download ITK
59+
run: |
60+
cd ..
61+
git clone https://github.com/InsightSoftwareConsortium/ITK.git
62+
cd ITK
63+
git checkout ${{ inputs.itk-git-tag }}
64+
65+
- name: Build ITK
66+
if: matrix.os != 'windows-2019'
67+
run: |
68+
cd ..
69+
mkdir ITK-build
70+
cd ITK-build
71+
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 ${{ inputs.itk-cmake-options }} -GNinja ../ITK
72+
ninja
73+
74+
- name: Build ITK
75+
if: matrix.os == 'windows-2019'
76+
run: |
77+
cd ..
78+
mkdir ITK-build
79+
cd ITK-build
80+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
81+
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 ${{ inputs.itk-cmake-options }} -GNinja ../ITK
82+
ninja
83+
shell: cmd
84+
85+
- name: Fetch CTest driver script
86+
run: |
87+
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
88+
89+
- name: Configure CTest script
90+
shell: bash
91+
run: |
92+
operating_system="${{ matrix.os }}"
93+
cat > dashboard.cmake << EOF
94+
set(CTEST_SITE "GitHubActions")
95+
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/.." CTEST_DASHBOARD_ROOT)
96+
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/" CTEST_SOURCE_DIRECTORY)
97+
file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../build" CTEST_BINARY_DIRECTORY)
98+
set(dashboard_source_name "${GITHUB_REPOSITORY}")
99+
if(ENV{GITHUB_REF} MATCHES "master")
100+
set(branch "-master")
101+
set(dashboard_model "Continuous")
102+
else()
103+
set(branch "-${GITHUB_REF}")
104+
set(dashboard_model "Experimental")
105+
endif()
106+
set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}")
107+
set(CTEST_UPDATE_VERSION_ONLY 1)
108+
set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL})
109+
set(CTEST_BUILD_CONFIGURATION "Release")
110+
set(CTEST_CMAKE_GENERATOR "Ninja")
111+
set(CTEST_CUSTOM_WARNING_EXCEPTION
112+
\${CTEST_CUSTOM_WARNING_EXCEPTION}
113+
# macOS Azure VM Warning
114+
"ld: warning: text-based stub file"
115+
)
116+
set(dashboard_no_clean 1)
117+
set(ENV{CC} ${{ matrix.c-compiler }})
118+
set(ENV{CXX} ${{ matrix.cxx-compiler }})
119+
if(WIN32)
120+
set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}")
121+
endif()
122+
set(dashboard_cache "
123+
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build
124+
BUILD_TESTING:BOOL=ON
125+
${{ inputs.cmake-options }}
126+
")
127+
string(TIMESTAMP build_date "%Y-%m-%d")
128+
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
129+
message("CTEST_SITE = \${CTEST_SITE}")
130+
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
131+
EOF
132+
cat dashboard.cmake
133+
134+
- name: Build and test
135+
if: matrix.os != 'windows-2019'
136+
run: |
137+
ctest --output-on-failure -j 2 -V -S dashboard.cmake
138+
139+
- name: Build and test
140+
if: matrix.os == 'windows-2019'
141+
run: |
142+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
143+
ctest --output-on-failure -j 2 -V -S dashboard.cmake
144+
shell: cmd
145+
146+
echo-linux-python:
147+
runs-on: ubuntu-20.04
148+
strategy:
149+
max-parallel: 2
150+
matrix:
151+
python-version: [37, 38, 39, 310]
152+
153+
steps:
154+
- name: 'Echo version'
155+
shell: bash
156+
run: |
157+
echo "OS ${{ runner.os }}"
158+
echo "Python version ${{ matrix.python-version }}"
159+
echo "ITK wheel tag ${{ inputs.itk-wheel-tag }}"
160+
161+
echo-macos-python:
162+
runs-on: macos-10.15
163+
strategy:
164+
max-parallel: 2
165+
166+
steps:
167+
- name: 'Echo version'
168+
shell: bash
169+
run: |
170+
echo "OS ${{ runner.os }}"
171+
echo "ITK wheel tag ${{ inputs.itk-wheel-tag }}"
172+
173+
build-windows-python-packages:
174+
runs-on: windows-2019
175+
strategy:
176+
max-parallel: 2
177+
matrix:
178+
python-version-minor: [7, 8, 9, 10]
179+
180+
steps:
181+
- name: 'Echo version'
182+
shell: bash
183+
run: |
184+
echo "OS ${{ runner.os }}"
185+
echo "Python version ${{ matrix.python-version-minor }}"
186+
echo "ITK wheel tag ${{ inputs.itk-wheel-tag }}"

0 commit comments

Comments
 (0)