-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (161 loc) · 6.25 KB
/
build-ants.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build ANTs
on:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
# first, rewrite OS names to be safe for github artifacts.
- name: names
run: |
OS="${{ matrix.os }}"
OS=$(echo "$OS" | sed s/://)
echo "ARTIFACT=$OS" >> $GITHUB_ENV
- name: package
run: |
# download and extract pre-built ants
case "${{ env.ARTIFACT }}" in
ubuntu-latest)
URL="https://github.com/ANTsX/ANTs/releases/download/v2.5.4/ants-2.5.4-ubuntu-24.04-X64-gcc.zip"
;;
macos-latest)
URL="https://github.com/ANTsX/ANTs/releases/download/v2.5.4/ants-2.5.4-macos-13-X64-clang.zip"
;;
esac
curl -L "$URL" -o ants-unix.zip
unzip ants-unix.zip
# snip out the apps we need for https://github.com/neuropoly/spinalcordtoolbox, since including all of ANTS is too much
mkdir sct-apps/
cp ants-2.5.4/bin/{antsRegistration,antsSliceRegularizedRegistration,antsApplyTransforms,ComposeMultiTransform} sct-apps
(cd sct-apps; for i in *; do mv $i isct_$i; done)
curl https://raw.githubusercontent.com/ANTsX/ANTs/refs/heads/master/COPYING.txt -o COPYING.txt
cp COPYING.txt sct-apps
tar -zcvf sct-apps_${{ env.ARTIFACT }}.tar.gz sct-apps/
continue-on-error: true
- name: results (DEBUG)
run: find .
- name: Upload result
uses: actions/upload-artifact@v4
with:
name: sct-apps_${{ env.ARTIFACT }}
#path: fakeroot/ # this is 2.3G large in this build
path: sct-apps_${{ env.ARTIFACT }}.tar.gz
build-manylinuxes: # Github only supports Ubuntu natively; for other Linuxes, we need to use Docker
strategy:
matrix:
os: ['quay.io/centos/centos:stream8']
runs-on: ubuntu-latest
container: ${{ matrix.os }}
steps:
- name: install centos toolchain
if: contains(matrix.os, 'centos:stream8')
run: |
# Sed commands come from https://archive.ph/FS47T
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
yum install -y gcc git curl unzip
- name: package
run: |
# download and extract pre-built ants
curl -L "https://github.com/ANTsX/ANTs/releases/download/v2.5.4/ants-2.5.4-almalinux8-X64-gcc.zip" -o ants-centos.zip
unzip ants-centos.zip
# snip out the apps we need for https://github.com/neuropoly/spinalcordtoolbox, since including all of ANTS is too much
mkdir sct-apps/
cp ants-2.5.4/bin/{antsRegistration,antsSliceRegularizedRegistration,antsApplyTransforms,ComposeMultiTransform} sct-apps
(cd sct-apps; for i in `ls`; do mv $i isct_$i; done)
curl https://raw.githubusercontent.com/ANTsX/ANTs/refs/heads/master/COPYING.txt -o COPYING.txt
cp COPYING.txt sct-apps
tar -zcvf sct-apps_centos-8.tar.gz sct-apps/
continue-on-error: true
- name: results (DEBUG)
run: find .
- name: Upload result
uses: actions/upload-artifact@v4
with:
name: sct-apps_centos-8
#path: fakeroot/ # this is 2.3G large in this build
path: sct-apps_centos-8.tar.gz
build-windows:
strategy:
matrix:
os: [ windows-latest ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
# first, rewrite OS names to be safe for github artifacts.
- name: names
run: |
OS="${{ matrix.os }}"
OS=$(echo "$OS" | sed s/://)
echo "ARTIFACT=$OS" >> $GITHUB_ENV
- name: package
run: |
curl -L "https://github.com/ANTsX/ANTs/releases/download/v2.5.4/ants-2.5.4-windows-2022-X64-VS2019.zip" -o ants-windows.zip
unzip ants-windows.zip
# snip out the apps we need for https://github.com/neuropoly/spinalcordtoolbox, since including all of ANTS is too much
mkdir sct-apps/
cp ants-2.5.4/bin/{antsRegistration,antsSliceRegularizedRegistration,antsApplyTransforms,ComposeMultiTransform}.exe sct-apps
(cd sct-apps; for i in `ls`; do mv $i isct_$i; done)
curl https://raw.githubusercontent.com/ANTsX/ANTs/refs/heads/master/COPYING.txt -o COPYING.txt
cp COPYING.txt sct-apps
tar -zcvf sct-apps_${{ env.ARTIFACT }}.tar.gz sct-apps/
continue-on-error: true
- name: results (DEBUG)
run: find .
- name: Upload result
uses: actions/upload-artifact@v4
with:
name: sct-apps_${{ env.ARTIFACT }}
path: sct-apps_${{ env.ARTIFACT }}.tar.gz
release:
needs: [build, build-manylinuxes, build-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: sct-apps_centos-8
continue-on-error: true
- name: checkin # DEBUG
run: find .
# - uses: actions/download-artifact@v4
# with:
# name: sct-apps_centos8
# continue-on-error: true
# - name: checkin # DEBUG
# run: find .
# - uses: actions/download-artifact@v4
# with:
# name: sct-apps_archlinux
# continue-on-error: true
- uses: actions/download-artifact@v4
with:
name: sct-apps_ubuntu-latest
continue-on-error: true
- uses: actions/download-artifact@v4
with:
name: sct-apps_macos-latest
continue-on-error: true
- uses: actions/download-artifact@v4
with:
name: sct-apps_windows-latest
continue-on-error: true
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# name the release with the run_id to allow multiple builds on the same branch/tag
# https://github.com/actions/create-release/issues/2#issuecomment-613591846
tag: ${{ github.ref }}-${{github.run_id }}
name: Release ${{ github.sha }}
draft: true
prerelease: true
artifacts: 'sct-apps_centos-8.tar.gz,sct-apps_ubuntu-latest.tar.gz,sct-apps_macos-latest.tar.gz,sct-apps_windows-latest.tar.gz'