@@ -182,8 +182,110 @@ jobs:
182
182
# path: fakeroot/ # this is 2.3G large in this build
183
183
path : sct-apps_${{ env.ARTIFACT }}.tar.gz
184
184
185
+ build-windows :
186
+ strategy :
187
+ matrix :
188
+ os : [ windows-2019 ]
189
+ runs-on : ${{ matrix.os }}
190
+ defaults :
191
+ run :
192
+ shell : bash
193
+ steps :
194
+ # first, rewrite OS names to be safe for github artifacts.
195
+ - name : names
196
+ run : |
197
+ OS="${{ matrix.os }}"
198
+ OS=$(echo "$OS" | sed s/://)
199
+ echo "ARTIFACT=$OS" >> $GITHUB_ENV
200
+ - uses : actions/checkout@v3
201
+ with :
202
+ repository : ANTsX/ANTs
203
+ # NB: This commit mirrors the state of the kousu/ANTs repository
204
+ # at the time of https://github.com/kousu/ANTs/pull/5.
205
+ ref : ${{ github.event.inputs.git_ref || 'b37e8b56e4e518b0f2947f80d0e3701a5ddfe120' }}
206
+ # The step below sets an option inside the cmake file to use the `https` protocol, which addresses:
207
+ # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
208
+ - name : Patch in fix for insecure git:// protocol
209
+ run : |
210
+ perl -pi -e 's/http instead." ON\)/http instead." OFF\)/g' SuperBuild.cmake
211
+
212
+ # ######################################### START OF ITK WORKAROUND ###############################################
213
+ # ITK v5.1 has an upstream bug (https://github.com/InsightSoftwareConsortium/ITK/issues/1967) that prevents
214
+ # building ITK with MS Visual Studio 2019 (which is what the `windows-2019` GitHub Actions runner uses). This bug
215
+ # was fixed in ITK v5.2.
216
+ #
217
+ # Normally, to pull in an upstream fix, we would update ANTs, which in turn would update ITK (because the `make`
218
+ # step for ANTs clones ITK to a specific commit, hardcoded by ANTs in its External_ITKv5.cmake file). However,
219
+ # updating ANTs to pull in the ITK v5.2 fix has the side effect of changing the registration results on SCT's end.
220
+ #
221
+ # So, we need a way to apply a fix for the ITK issue that *doesn't* involve updating ANTs. Luckily, there is a
222
+ # quick and dirty workaround, described here: https://github.com/SuperElastix/SimpleElastix/pull/425#issuecomment-878516818
223
+ #
224
+ # In order to apply the workaround, we have to manually clone ITK ourselves (prior to the ANTs `make` step),
225
+ # then apply the fix, then continue on with building ANTs normally.
226
+ #
227
+ # TODO: Remove this fix after we update ANTs to a version that uses ITK v5.2 or higher.
228
+ # #################################################################################################################
229
+ - name : ' WORKAROUND: Manually clone ITK'
230
+ run : |
231
+ mkdir antsbin
232
+ cd antsbin
233
+ git clone https://github.com/InsightSoftwareConsortium/ITK.git ITKv5
234
+ cd ITKv5
235
+ git checkout 1e708db2f586997e408cfdc2cea5114ae5575892 # This commit corresponds to:
236
+ # https://github.com/ANTsX/ANTs/blob/b37e8b56e4e518b0f2947f80d0e3701a5ddfe120/SuperBuild/External_ITKv5.cmake#L154
237
+ # i.e. the ITK commit specified by the version of ANTs we're currently using.
238
+ - name : ' WORKAROUND: Apply fix for `lrintf` issue in ITK dependency'
239
+ run : sed -i '93,120d' antsbin/ITKv5/Modules/ThirdParty/OpenJPEG/src/openjpeg/opj_includes.h
240
+ - name : ' WORKAROUND: Skip ITK clone in Superbuild'
241
+ run : |
242
+ # These `sed` commands remove the git project settings from the `ExternalProject_Add` cmake function call
243
+ sed -i '/ GIT_REPOSITORY ${${proj}_REPOSITORY}/d' SuperBuild/External_ITKv5.cmake
244
+ sed -i '/ GIT_TAG ${${proj}_GIT_TAG}/d' SuperBuild/External_ITKv5.cmake
245
+ # ########################################## END OF ITK WORKAROUND ################################################
246
+
247
+ - name : cmake generate
248
+ run : |
249
+ cd antsbin
250
+ # NB: `BUILD_TESTING=OFF` fixes https://github.com/ANTsX/ANTs/issues/1236
251
+ cmake \
252
+ -DBUILD_TESTING=OFF \
253
+ -DBUILD_SHARED_LIBS=OFF \
254
+ -DZLIB_INCLUDE_DIR=D:\lib\zlib \
255
+ -DZLIB_LIBRARY=D:\lib\zlib\libz.dll.a \
256
+ ../
257
+ - name : Add msbuild to PATH
258
+
259
+ with :
260
+ msbuild-architecture : x64
261
+ - name : make
262
+ working-directory : antsbin
263
+ shell : cmd
264
+ run : |
265
+ msbuild ALL_BUILD.vcxproj -property:Configuration=Release
266
+ timeout-minutes : 300
267
+ # for debugging, don't let a crash/timeout here fail the whole build
268
+ # (github CI seems glitchy about giving reliable output about what happened on timeouts)
269
+ continue-on-error : true
270
+ - name : package
271
+ run : |
272
+ # snip out the apps we need for https://github.com/neuropoly/spinalcordtoolbox, since including all of ANTS is too much
273
+ mkdir sct-apps/
274
+ cp antsbin/ANTS-build/Examples/Release/{antsRegistration,antsSliceRegularizedRegistration,antsApplyTransforms,ComposeMultiTransform}.exe sct-apps
275
+ (cd sct-apps; for i in `ls`; do mv $i isct_$i; done)
276
+ cp COPYING.txt sct-apps
277
+ tar -zcvf sct-apps_${{ env.ARTIFACT }}.tar.gz sct-apps/
278
+ continue-on-error : true
279
+ - name : results (DEBUG)
280
+ run : find .
281
+ - name : Upload result
282
+ uses : actions/upload-artifact@v2-preview
283
+ with :
284
+ name : sct-apps_${{ env.ARTIFACT }}
285
+ path : sct-apps_${{ env.ARTIFACT }}.tar.gz
286
+
185
287
release :
186
- needs : [build, build-manylinuxes]
288
+ needs : [build, build-manylinuxes, build-windows ]
187
289
runs-on : ubuntu-latest
188
290
steps :
189
291
- name : Create Release
@@ -293,3 +395,18 @@ jobs:
293
395
asset_name : sct-apps_macos-10.15.tar.gz
294
396
asset_content_type : application/gzip
295
397
continue-on-error : true
398
+
399
+ - uses : actions/download-artifact@v1
400
+ with :
401
+ name : sct-apps_windows-2019
402
+ continue-on-error : true
403
+ - name : Upload Release Asset
404
+ uses : actions/upload-release-asset@v1
405
+ env :
406
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
407
+ with :
408
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
409
+ asset_path : ./sct-apps_windows-2019/sct-apps_windows-2019.tar.gz
410
+ asset_name : sct-apps_windows-2019.tar.gz
411
+ asset_content_type : application/gzip
412
+ continue-on-error : true
0 commit comments