forked from kousu/spinalcordtoolbox-binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (150 loc) · 7.02 KB
/
package-binaries.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
name: Package SCT C++ binaries
on:
pull_request:
workflow_dispatch:
inputs:
release_title:
description: 'Release title (e.g. rYYYYMMDD)'
required: true
# all this does is collect three dependencies,
# - spinalcordtoolbox-ants which essentially a more minimal fork of https://github.com/ANTsX/ANTs
# - spinalcordtoolbox-dev, which comes from https://github.com/neuropoly/spinalcordtoolbox/blob/master/dev
# - ctrDetect, from https://www.creatis.insa-lyon.fr/site7/en/ctrDetect
# and squish them together in a single file.
# while making sure they all have the prefix "isct_" on them.
# TODO: include some checksums; the ctrDetect upstream doesn't even use TLS.
jobs:
build:
strategy:
matrix:
os: [linux, osx, windows]
runs-on: ubuntu-latest
steps:
# upstream: https://github.com/neuropoly/ANTs, which has had its build reduced to only output 4 programs.
- name: get spinalcordtoolbox-ants
run: |
# TODO: this is currently at kousu/ANTs; get it moved to neuropoly/ANTs
case "${{ matrix.os }}" in
linux)
URL="https://github.com/spinalcordtoolbox/build_ANTs/releases/download/r20220516-2/sct-apps_centos7.tar.gz"
;;
osx)
URL="https://github.com/spinalcordtoolbox/build_ANTs/releases/download/r20220516-2/sct-apps_macos-10.15.tar.gz"
;;
windows)
URL="https://github.com/spinalcordtoolbox/build_ANTs/releases/download/r20220516-2/sct-apps_windows-2019.tar.gz"
;;
esac
curl -L "$URL" -o spinalcordtoolbox-ants.tar.gz
mkdir -p spinalcordtoolbox-ants && tar -zxvf spinalcordtoolbox-ants.tar.gz -C spinalcordtoolbox-ants
mkdir -p pkg && cp -rp spinalcordtoolbox-ants/sct-apps/* pkg/
mkdir -p pkg/copyright
mv pkg/COPYING.txt pkg/copyright/LICENSE_ANTs.txt
# upstream: hhttps://github.com/biomedia-mira/stitching
- name: get stitching
run: |
case "${{ matrix.os }}" in
linux)
URL="https://github.com/spinalcordtoolbox/build_biomedia_stitching/releases/download/r20221109/stitching_centos-7.tar.gz"
;;
osx)
URL="https://github.com/spinalcordtoolbox/build_biomedia_stitching/releases/download/r20221018/stitching_macos-10.15.tar.gz"
;;
windows)
URL="https://github.com/spinalcordtoolbox/build_biomedia_stitching/releases/download/r20221018/stitching_windows-2019.tar.gz"
;;
esac
curl -L "$URL" -o stitching.tar.gz
mkdir -p stitching && tar -zxvf stitching.tar.gz -C stitching
mkdir -p pkg && cp -rp stitching/archive/* pkg/
# upstream: https://github.com/neuropoly/spinalcordtoolbox/blob/master/dev/{isct_propseg,isct_dice_coefficient}
- name: get spinalcordtoolbox-dev
run: |
# TODO: get this building, then building in CI, and use the release from there.
# These URLs contain a version that hasn't been recompiled since 2016.
case "${{ matrix.os }}" in
linux)
URL="https://github.com/spinalcordtoolbox/spinalcordtoolbox-binaries/releases/download/binaries_dev/20160716_sct_binaries_dev_linux.tar.gz"
;;
osx)
URL="https://github.com/spinalcordtoolbox/spinalcordtoolbox-binaries/releases/download/binaries_dev/20161123_sct_binaries_dev_osx.tar.gz"
;;
windows)
URL="https://github.com/spinalcordtoolbox/spinalcordtoolbox-binaries/releases/download/binaries_dev/20220225_sct_binaries_dev_windows.tar.gz"
;;
esac
curl -L "$URL" -o spinalcordtoolbox-dev.tar.gz
mkdir -p pkg
mkdir -p spinalcordtoolbox-dev && tar -zxvf spinalcordtoolbox-dev.tar.gz -C spinalcordtoolbox-dev
cp -rp spinalcordtoolbox-dev/* pkg/
# upstream: https://www.creatis.insa-lyon.fr/site7/en/ctrDetect
- name: get ctrDetect
run: |
echo "test test trying to build for ${{ matrix.os }}"
mkdir -p pkg
case "${{ matrix.os }}" in
linux)
URL="http://www.creatis.insa-lyon.fr/~sdika/soft/ctrDetect-v1_x86_64.tar.gz"
curl -L "$URL" -o ctrDetect.tar.gz
tar -zxvf ctrDetect.tar.gz
cp -p ctrDetect/{spine_detect,spine_train_svm} pkg/
mv pkg/spine_train_svm pkg/train_svm # we have this one named unusually
;;
osx)
URL="http://www.creatis.insa-lyon.fr/~sdika/soft/ctrDetect-v1_macos10.11.tar.gz"
curl -L "$URL" -o ctrDetect.tar.gz
tar -zxvf ctrDetect.tar.gz
cp -p ctrDetect/{spine_detect,spine_train_svm} pkg/
mv pkg/spine_train_svm pkg/train_svm # we have this one named unusually
;;
windows)
URL="http://www.creatis.insa-lyon.fr/~sdika/soft/ctrDetect-v1_win.zip"
curl -L "$URL" -o ctrDetect.zip
unzip ctrDetect.zip
mv ctrDetect-win/ ctrDetect
cp -p ctrDetect/{spine_detect,spine_train_svm}.exe pkg/
mv pkg/spine_train_svm.exe pkg/train_svm.exe # we have this one named unusually
;;
esac
cp -p ctrDetect/LICENSE.txt pkg/copyright/LICENSE_ctrDetect.txt
cp -p ctrDetect/LICENSE_opencv.txt pkg/copyright/
chmod -x pkg/copyright/* # upstream accidentally marked the licenses as programs, oops.
- name: "'isct_' prefix"
run: |
# TODO: there's gotta be a shorter way to do this
# add the isct_ to programs that don't already have it
cd pkg
find ./ -type f -executable ! -name "isct_*" -maxdepth 1 | while read fname; do mv "$fname" $(dirname "$fname")/isct_$(basename "$fname"); done
- name: package
run: |
# Github Artifacts only make .zips, so make a .tar.gz manually to preserve permissions/dates/etc
tar -zcvf spinalcordtoolbox-binaries_${{ matrix.os }}.tar.gz -C pkg ./
- name: upload result
uses: actions/upload-artifact@v3
with:
name: spinalcordtoolbox-binaries_${{ matrix.os }}
path: spinalcordtoolbox-binaries_${{ matrix.os }}.tar.gz
release:
needs: [build]
runs-on: ubuntu-latest
# Only attach to release if workflow is run manually. (This allows the workflow to double as a PR test.)
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/download-artifact@v3
with:
name: spinalcordtoolbox-binaries_linux
- uses: actions/download-artifact@v3
with:
name: spinalcordtoolbox-binaries_osx
- uses: actions/download-artifact@v3
with:
name: spinalcordtoolbox-binaries_windows
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.inputs.release_title }}
name: Release ${{ github.sha }}
draft: true
artifacts: "spinalcordtoolbox-binaries_linux.tar.gz,spinalcordtoolbox-binaries_osx.tar.gz,spinalcordtoolbox-binaries_windows.tar.gz"
artifactContentType: application/gzip