-
Notifications
You must be signed in to change notification settings - Fork 21
176 lines (156 loc) · 4.59 KB
/
build.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
173
174
175
176
name: Build
# This workflow is triggered on pushes to the repository.
on: push
env:
BUILD_TYPE: Release
jobs:
build:
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu GCC", artifact: "qi-linux.tar.gz",
os: ubuntu-22.04,
cc: "gcc-11", cxx: "g++-11"
}
- {
name: "macOS", artifact: "qi-macos.tar.gz",
os: macos-12,
cc: "clang", cxx: "clang++"
}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Install Build Tools
shell: bash
run: |
if [ "${{runner.os}}" == "macOS" ]; then
brew install gnu-tar automake autoconf autoconf-archive
else
sudo apt-get update
sudo apt-get install automake autoconf autoconf-archive
fi
- name: Restore vcpkg binary cache
id: cache
uses: actions/cache@v3
with:
path: ~/.cache/vcpkg/
key: ${{runner.os}}-${{hashFiles( 'vcpkg.json' ) }}-${{hashFiles( '.git/modules/cmake/HEAD' )}}-vcpkg-cache
- name: Build
shell: bash
env:
CC: ${{matrix.config.cc}}
CXX: ${{matrix.config.cxx}}
run: |
TC="${{github.workspace}}/cmake/toolchain.cmake"
export VCPKG_OVERLAY_TRIPLETS="${{github.workspace}}/cmake/triplets"
export FLAGS="ci"
cd ${{github.workspace}}
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$TC"
cmake --build build
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Prepare Python
run: |
python -m pip install --upgrade pip
pip install nipype
pip install -e ./Python/
shell: bash
- name: Run Tests
working-directory: ./Python/Tests
shell: bash
run: |
if [ "${{runner.os}}" != "macOS" ]; then # MacOS runners do not have AVX2
export PATH="$PWD/../../build/Source:$PATH"; python -m unittest discover
fi
- name: Save release
run: |
mv ./build/Source/qi ./qi
if [ "${{runner.os}}" == "macOS" ]; then
echo "Using GNU tar"
gtar -czf ${{matrix.config.artifact}} qi
else
echo "Using system tar"
tar -czf ${{matrix.config.artifact}} qi
fi
shell: bash
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{matrix.config.artifact}}
name: ${{matrix.config.artifact}}
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: Release ${{github.ref}}
draft: true
prerelease: false
- name: Store Release URL
run: |
echo "${{steps.create_release.outputs.upload_url}}" > ./upload_url
- uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url
publish:
if: contains(github.ref, 'tags/v')
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu GCC", artifact: "qi-linux.tar.gz",
os: ubuntu-16.04
}
- {
name: "macOS", artifact: "qi-macos.tar.gz",
os: macos-10.15
}
needs: release
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: ${{matrix.config.artifact}}
path: ./
- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- name: Set Upload URL
id: set_upload_url
run: |
URL=`cat ./upload_url`
echo ${URL}
echo "::set-output name=upload_url::${URL}"
- name: Upload to Release
id: upload_to_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}
asset_content_type: application/gzip