-
Notifications
You must be signed in to change notification settings - Fork 17
329 lines (266 loc) · 10 KB
/
main.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: MetaGraph CI
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
Linux:
runs-on: ubuntu-20.04
strategy:
matrix:
alphabet: [DNA, Protein]
build_type: [Debug, Release]
compiler: [g++-8, g++-9, g++-10, g++-11]
build_static: [OFF, ON]
with_avx: [OFF, ON]
include:
- compiler: g++-8
cxx: g++-8
cc: gcc-8
- compiler: g++-9
cxx: g++-9
cc: gcc-9
- compiler: g++-10
cxx: g++-10
cc: gcc-10
- compiler: g++-11
cxx: g++-11
cc: gcc-11
exclude:
- alphabet: Protein
compiler: g++-9
- compiler: g++-8
build_static: ON
- compiler: g++-9
build_static: ON
- compiler: g++-10
build_static: ON
- build_type: Debug
build_static: ON
- with_avx: OFF
build_static: OFF
name: Linux (${{ matrix.alphabet }}, ${{ matrix.build_type }}, ${{ matrix.compiler }}${{ matrix.build_static == 'ON' && ', static' || '' }}${{ matrix.with_avx == 'OFF' && ', noAVX' || '' }})
steps:
- uses: actions/checkout@v1
- name: checkout submodules
run: git submodule update --init --recursive
- name: install dependencies
run: |
sudo apt-get update
# If clang, use the default version. Otherwise the compiler install with apt-get.
if [[ "${{ matrix.compiler }}" != "clang" ]]; then
sudo apt-get install ${{ matrix.compiler }}
fi
sudo apt-get install libbz2-dev libjemalloc-dev libboost-all-dev libdeflate-dev
if [ "${{ matrix.build_static }}" = "ON" ]; then
# for static builds, compile curl ourselves
git clone https://github.com/curl/curl.git
mkdir curl/_build
cd curl/_build
cmake -DBUILD_SHARED_LIBS=off ..
make -j 2
sudo make install
cd ..
fi
echo "CC=$(which ${{ matrix.cc }})" >> $GITHUB_ENV
echo "CXX=$(which ${{ matrix.cxx }})" >> $GITHUB_ENV
- name: install dependencies for integration tests
run: |
pip3 install parameterized
sudo apt-get install python3-venv
- name: install sdsl-lite
run: |
cd metagraph/external-libraries/sdsl-lite
./install.sh $(pwd)
- name: configure
run: |
mkdir metagraph/build
cd metagraph/build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_STATIC=${{ matrix.build_static }} \
-DWITH_AVX=${{ matrix.with_avx }} -DWITH_MSSE42=${{ matrix.with_avx }} \
-DCMAKE_DBG_ALPHABET=${{ matrix.alphabet }} ..
- name: build metagraph
run: cd metagraph/build && make -j 2 metagraph
- name: build unit tests
if: matrix.build_static == 'OFF'
run: cd metagraph/build && make -j 2 unit_tests
- name: build other
if: matrix.build_static == 'OFF'
run: cd metagraph/build && make -j 2
# for potential release
- name: rename binary
if: matrix.with_avx == 'OFF'
run: mv metagraph/build/metagraph_${{ matrix.alphabet }} metagraph/build/metagraph_${{ matrix.alphabet }}_noAVX
- name: upload static binary
if: ${{ matrix.build_static == 'ON' && matrix.compiler == 'g++-11' }}
uses: actions/upload-artifact@v4
with:
name: metagraph_${{ matrix.alphabet }}${{ matrix.with_avx == 'OFF' && '_noAVX' || '' }}_linux_x86
path: metagraph/build/metagraph_${{ matrix.alphabet }}${{ matrix.with_avx == 'OFF' && '_noAVX' || '' }}
- name: run unit tests
if: matrix.build_static == 'OFF'
run: |
export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH"
cd metagraph/build && ./unit_tests
- name: run integration tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 1000
max_attempts: 5
retry_on: error
command: |
export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH"
cd metagraph/build && make check
MacOS:
runs-on: macos-latest
strategy:
matrix:
alphabet: [DNA]
build_type: [Debug, Release]
platform: [x64, arm64]
steps:
- uses: actions/checkout@v1
- name: checkout submodules
run: git submodule update --init --recursive
- name: install dependencies
run: brew install bzip2 libomp boost jemalloc autoconf automake libtool libdeflate
- name: install dependencies for integration tests
run: pip3 install parameterized --break-system-packages --user
- name: install sdsl-lite
run: |
cd metagraph/external-libraries/sdsl-lite
./install.sh $(pwd)
- name: configure
run: |
mkdir metagraph/build
cd metagraph/build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_DBG_ALPHABET=${{ matrix.alphabet }} \
-DWITH_AVX=OFF -DWITH_MSSE42=OFF ..
- name: build metagraph
run: cd metagraph/build && make -j 2 metagraph
- name: build unit tests
run: cd metagraph/build && make -j 2 unit_tests
- name: build other
run: cd metagraph/build && make -j 2
- name: run unit tests
run: cd metagraph/build && ./unit_tests
- name: run integration tests
run: cd metagraph/build && make check
Metagraph-Workflows:
name: Test metagraph workflows
runs-on: ubuntu-20.04
needs: [Linux]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: fetch static binary
uses: actions/download-artifact@v4
with:
path: artifacts
- name: setup metagraph binary
run: |
sudo ln -s $(pwd)/artifacts/metagraph_DNA_linux_x86/metagraph_DNA /usr/local/bin/metagraph
sudo chmod +rx /usr/local/bin/metagraph
/usr/local/bin/metagraph --help
metagraph --help
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r metagraph/workflows/requirements.txt
- name: Test metagraph-workflows pytest
run: |
cd metagraph/workflows
pytest
Build-and-Push-Docker:
# adapted from https://docs.github.com/en/actions/guides/publishing-docker-images#publishing-images-to-github-packages
if: github.event_name != 'pull_request'
needs: [Linux, Metagraph-Workflows]
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: checkout submodules
run: git submodule update --init --recursive
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Release:
name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [Linux, Metagraph-Workflows]
steps:
- uses: actions/checkout@v1
- name: checkout submodules
run: git submodule update --init --recursive
- name: fetch static binary
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Tag name
id: tag_name
run: |
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=VER::${GITHUB_REF#refs/tags/v}
# from https://stackoverflow.com/a/61919791/6869319
- name: read current version
id: read_version
run: |
content=`cat package.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
- name: build source archive including submodules
run: |
[[ v${{fromJson(steps.read_version.outputs.packageJson).version}} == ${{ steps.tag_name.outputs.TAG }} ]] \
|| (echo "::error file=package.json::Version in package.json (v${{fromJson(steps.read_version.outputs.packageJson).version}}) does not match tag ${{ steps.tag_name.outputs.TAG }}. Update package.json and set the tag again."; \
exit 1)
mkdir -p artifacts/sources
tag=${{ steps.tag_name.outputs.TAG }}
bash .github/workflows/git-archive-all.sh --format tar.gz artifacts/sources/${tag}-sources-with-submodules.tar.gz
bash .github/workflows/git-archive-all.sh --format zip artifacts/sources/${tag}-sources-with-submodules.zip
- name: create release with static binaries
uses: svenstaro/upload-release-action@v2
with:
release_name: Version ${{ steps.tag_name.outputs.VER }}
body: |
The pre-compiled binaries (only for Linux) are statically linked and hence don't require additional libraries to be installed.
The *_noAVX binaries are compiled without the modern AVX2 and MSSE4.2 instructions and should be used when the processor does not support these instructions.
file: 'artifacts/*/*'
file_glob: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
prerelease: true