8
8
description : ' Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
9
9
required : false
10
10
default : false
11
+ use_cached_itksnap_build :
12
+ type : boolean
13
+ description : ' Use cached build results from last run'
14
+ required : false
15
+ default : false
11
16
# push:
12
17
# release:
13
18
# types:
@@ -18,12 +23,37 @@ jobs:
18
23
name : Build wheels on ${{ matrix.os }}
19
24
runs-on : ${{ matrix.os }}
20
25
strategy :
26
+ fail-fast : false
21
27
matrix :
22
- # os: [ubuntu-20.04,macos-13,macos-14,windows-2019]
23
- os : [ubuntu-20.04]
28
+ os : [ubuntu-20.04,macos-13,macos-14,windows-2022]
29
+ itk_ver : [ '5.4.0' ]
30
+ vtk_ver : [ '9.3.1' ]
31
+ qt_ver : [ '6.6.3' ]
32
+ include :
33
+ - os : ubuntu-20.04
34
+ qt_host : linux
35
+ qt_arch : gcc_64
36
+ test_pref : xvfb-run -a
37
+ - os : macos-13
38
+ qt_host : mac
39
+ qt_arch : clang_64
40
+ test_pref : ' '
41
+ - os : macos-14
42
+ qt_host : mac
43
+ qt_arch : clang_64
44
+ test_pref : ' '
45
+ - os : windows-2022
46
+ qt_host : windows
47
+ qt_arch : win64_msvc2019_64
48
+ test_pref : ' '
24
49
25
50
steps :
26
51
52
+ # Select MSVC tools on windows
53
+ - name : Select MSVC 2019
54
+ uses : ilammy/msvc-dev-cmd@v1
55
+ if : ${{ runner.os == 'Windows' }}
56
+
27
57
# Setup ninja
28
58
- name : Setup Ninja
29
59
uses : seanmiddleditch/gha-setup-ninja@master
@@ -34,33 +64,44 @@ jobs:
34
64
with :
35
65
brew : curl
36
66
apt : libcurl4-openssl-dev
37
- choco : curl
67
+ choco : nsis
38
68
69
+ # Install curl on Windows
70
+ - name : Install libcurl on Windows
71
+ uses : johnwason/vcpkg-action@v6
72
+ id : vcpkg
73
+ if : ${{ runner.os == 'Windows' }}
74
+ with :
75
+ pkgs : curl
76
+ triplet : x64-windows-release
77
+ token : ${{ github.token }}
78
+ github-binarycache : false
79
+
39
80
# Install Qt
40
81
- name : Install Qt on Ubuntu
41
82
uses : jurplel/install-qt-action@v4
42
- if : ${{ startsWith(matrix.os,'ubuntu') }}
43
83
with :
44
- version : ' 6.6.3'
45
- host : ' linux'
84
+ version : ${{ matrix.qt_ver }}
46
85
target : ' desktop'
47
- arch : ' gcc_64'
86
+ host : ${{ matrix.qt_host }}
87
+ arch : ${{ matrix.qt_arch }}
88
+ cache : true
48
89
49
90
# Use cached VTK build if available
50
- - name : Cache VTK
91
+ - name : Restore VTK Cache
51
92
id : cache-vtk
52
- uses : actions/cache@v4
93
+ uses : actions/cache/restore @v4
53
94
with :
54
95
path : ${{github.workspace}}/vtk/install
55
- key : ${{ runner .os }}-vtk-9.3.1
96
+ key : ${{ matrix .os }}-vtk-${{ matrix.vtk_ver }}
56
97
57
98
# Check out VTK
58
99
- name : Checkout VTK
59
100
if : steps.cache-vtk.outputs.cache-hit != 'true'
60
101
uses : actions/checkout@v4
61
102
with :
62
103
repository : ' Kitware/VTK.git'
63
- ref : ' v9.3.1 '
104
+ ref : v${{ matrix.vtk_ver }}
64
105
submodules : true
65
106
path : ' vtk'
66
107
71
112
with :
72
113
source-dir : ${{github.workspace}}/vtk
73
114
build-dir : ${{github.workspace}}/vtk/build
74
- build-args : |
75
- -t
76
- install
115
+ build-args : " -t install -- -k 0"
77
116
generator : Ninja
78
117
options : |
79
118
BUILD_TESTING:BOOL=FALSE
@@ -83,25 +122,35 @@ jobs:
83
122
VTK_GROUP_ENABLE_Qt:STRING=YES
84
123
VTK_MODULE_ENABLE_VTK_GUISupportQtQuick:STRING=NO
85
124
VTK_MODULE_ENABLE_VTK_GUISupportQtSQL:STRING=NO
125
+ CMAKE_BUILD_TYPE=Release
86
126
CMAKE_INSTALL_PREFIX=${{github.workspace}}/vtk/install
127
+ ${{ runner.os == 'Windows' && 'VTK_SMP_ENABLE_STDTHREAD=OFF' || '' }}
87
128
129
+ # Cache the VTK build
130
+ - name : Cache VTK
131
+ if : steps.cache-vtk.outputs.cache-hit != 'true'
132
+ uses : actions/cache/save@v4
133
+ with :
134
+ path : ${{github.workspace}}/vtk/install
135
+ key : ${{ matrix.os }}-vtk-${{ matrix.vtk_ver }}
136
+
88
137
# Use cached ITK build if available. Unfortunately ITK make install fails to
89
138
# install one file, vnl_vector_ref.hxx so instead of caching the install dir
90
139
# we are caching the build dir
91
- - name : Cache ITK
140
+ - name : Restore ITK Cache
92
141
id : cache-itk
93
- uses : actions/cache@v4
142
+ uses : actions/cache/restore @v4
94
143
with :
95
- path : ${{github.workspace}}/itk/build
96
- key : ${{ runner .os }}-itk-5.4.0 -build
144
+ path : ${{github.workspace}}/itk
145
+ key : ${{ matrix .os }}-itk-${{ matrix.itk_ver }} -build
97
146
98
147
# Check out ITK
99
148
- name : Checkout ITK
100
149
if : steps.cache-itk.outputs.cache-hit != 'true'
101
150
uses : actions/checkout@v4
102
151
with :
103
152
repository : ' InsightSoftwareConsortium/ITK.git'
104
- ref : ' v5.4.0 '
153
+ ref : v${{ matrix.itk_ver }}
105
154
submodules : true
106
155
path : ' itk'
107
156
@@ -120,35 +169,86 @@ jobs:
120
169
BUILD_TESTING:BOOL=FALSE
121
170
BUILD_EXAMPLES:BOOL=FALSE
122
171
Module_MorphologicalContourInterpolation:BOOL=TRUE
172
+ CMAKE_BUILD_TYPE=Release
123
173
CMAKE_INSTALL_PREFIX=${{github.workspace}}/itk/install
174
+
175
+ - name : Cache ITK
176
+ if : steps.cache-itk.outputs.cache-hit != 'true'
177
+ uses : actions/cache/save@v4
178
+ with :
179
+ path : ${{github.workspace}}/itk
180
+ key : ${{ matrix.os }}-itk-${{ matrix.itk_ver }}-build
124
181
182
+ # Restore ITK-SNAP cache if requested by the user. This should allow us to create faster builds
183
+ # because only the updated files should require rebuilding
184
+ - name : Restore ITK-SNAP Cache (optional)
185
+ id : cache-restore-itksnap
186
+ uses : actions/cache/restore@v4
187
+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.use_cached_itksnap_build }}
188
+ with :
189
+ path : ${{github.workspace}}/itksnap
190
+ key : ${{ matrix.os }}-itksnap-build-${{ github.ref }}
191
+
125
192
# Checkout ITK-SNAP code
126
193
- name : Checkout code
194
+ if : steps.cache-restore-itksnap.outputs.cache-hit != 'true'
127
195
uses : actions/checkout@v4
128
196
with :
129
197
submodules : true
198
+ clean : false
130
199
path : ' itksnap'
131
200
132
- - name : Setup tmate session
133
- uses : mxschmitt/action-tmate@v3
134
- if : ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
135
-
136
- # Build ITK-SNAP
137
- - name : Build ITK-SNAP
138
- if : ${{ 1 == 2 }}
201
+ # Configure ITK-SNAP
202
+ - name : Configure ITK-SNAP
203
+ if : steps.cache-restore-itksnap.outputs.cache-hit != 'true'
139
204
uses : threeal/cmake-action@v2.0.0
205
+ continue-on-error : true
140
206
with :
141
207
source-dir : ${{github.workspace}}/itksnap
142
208
build-dir : ${{github.workspace}}/itksnap/build
143
- build-args : |
144
- -t
145
- install
146
209
generator : Ninja
210
+ run-build : false
211
+ args : ${{ runner.os == 'Windows' && steps.vcpkg.outputs.vcpkg-cmake-config || '' }}
147
212
options : |
148
213
ITK_DIR=${{github.workspace}}/itk/build
149
214
VTK_DIR=${{github.workspace}}/vtk/install/lib/cmake/vtk-9.3
150
- CMAKE_PREFIX_PATH=${{github.workspace}}/../Qt/6.6.3/linux/lib/cmake
151
215
CMAKE_BUILD_TYPE=Release
216
+ DO_UPLOAD=ON
217
+ SITE=github-runner-${{ matrix.os }}
218
+ ${{ runner.os == 'Windows' && format('CURL_LIBRARY={0}/vcpkg/installed/x64-windows-release/lib/libcurl.lib', github.workspace) || '' }}
219
+ ${{ runner.os == 'Windows' && format('CURL_INCLUDE_DIR={0}/vcpkg/installed/x64-windows-release/include', github.workspace) || '' }}
220
+
221
+ # Build ITK-SNAP using CDash
222
+ - name : Build and Test ITK-SNAP
223
+ if : steps.cache-restore-itksnap.outputs.cache-hit != 'true'
224
+ working-directory : ${{github.workspace}}/itksnap/build
225
+ run : |
226
+ ${{ matrix.test_pref }} ctest -D ExperimentalStart
227
+ ${{ matrix.test_pref }} ctest -D ExperimentalConfigure
228
+ ${{ matrix.test_pref }} ctest -D ExperimentalBuild
229
+ ${{ matrix.test_pref }} ctest -D ExperimentalTest ${{ runner.os != 'Windows' && '| echo "no problem"' || '' }}
230
+ ${{ matrix.test_pref }} ctest -D ExperimentalSubmit
231
+
232
+ # Cache the ITK-SNAP build
233
+ - name : Cache ITK-SNAP build directory
234
+ if : steps.cache-restore-itksnap.outputs.cache-hit != 'true'
235
+ uses : actions/cache/save@v4
236
+ with :
237
+ path : ${{github.workspace}}/itksnap
238
+ key : ${{ matrix.os }}-itksnap-build-${{ github.ref }}
239
+
240
+ - name : Setup tmate session
241
+ uses : mxschmitt/action-tmate@v3
242
+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
243
+
244
+ # Package ITK-SNAP
245
+ - name : Package ITK-SNAP
246
+ continue-on-error : true
247
+ working-directory : ${{github.workspace}}/itksnap/build
248
+ run : |
249
+ ninja -v package
250
+
251
+
152
252
153
253
154
254
0 commit comments