-
Notifications
You must be signed in to change notification settings - Fork 74
/
.gitlab-ci.yml
341 lines (293 loc) · 9.5 KB
/
.gitlab-ci.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
330
331
332
333
334
335
336
337
338
339
340
341
include:
- project: "epi2melabs/ci-templates"
file: "push-conda.yaml"
- project: "epi2melabs/ci-templates"
file: "snippets.yaml"
image: ${UBUNTU_IMAGE}:20.04
stages:
- test
- build
- release
# Install a particular Python and set PYTHON envvar for Makefile
.install-pyenv: &install-pyenv |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install ${PYENV_VERSION}
export PYTHON=$(PYENV_VERSION=$PYENV_VERSION pyenv which python)
.preparetest: &preparetest
stage: test
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -qq
- apt-get install -y -qq
gcc make cmake curl wget git
zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libcurl4-gnutls-dev
libssl-dev libffi-dev valgrind
libreadline8 libreadline-dev sqlite3 libsqlite3-dev
- *install-pyenv
.minimal-python: &minimal-python
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -qq && apt-get install -y -qq
python3-all-dev python3-venv
# Check that the changelog is up to date and other stuff
# do this is test 'cos no one wants to wait for all the
# wheels to build to find out they forgot to update the log
deploy-checks:
stage: test
script:
- export LICENSE_FILE="ONT-LICENSE"
- !reference [.check, python-version]
- !reference [.check, changelog]
- !reference [.check, license]
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'
# medaka test suite on various Pythons, latest as of 2024-08-14
pytest: &pytest
<<: *preparetest
variables:
MEDAKA_CPU: 1
script:
- make test
- make test-consensus
- make test-variants
parallel:
matrix:
- PYENV_VERSION: 3.8.19
- PYENV_VERSION: 3.9.19
- PYENV_VERSION: 3.10.14
- PYENV_VERSION: 3.11.9
# no edlib for 3.12, and bdist_wheel fails
#- PYENV_VERSION: 3.12.5
test-mem-check:
variables:
PYENV_VERSION: 3.8.18
<<: *preparetest
script:
- make mem_check
###
# Source distribution
#
build:sdist:
stage: build
<<: *minimal-python
script:
- make sdist
artifacts:
paths:
- dist/*.tar.gz
###
# Many linux builds
#
.many-linux:
stage: build
variables:
DO_COUNT_TEST: 1
MEDAKA_CPU: 1
script:
- echo "Building a Python ${PYWHEEL} wheel on manylinux_${FLAVOUR} for ${COMPUTE}"
- if [[ "${COMPUTE}" == "cpu" ]]; then export PACKAGE_NAME=medaka-cpu; sed -i "s/torch==[0-9]\+[\.0-9]\+/&+cpu/" requirements.txt; fi
- cat requirements.txt
- ./build-wheels.sh . ${PYWHEEL}
artifacts:
paths:
- wheelhouse-final/*.whl
wheels-2014:
extends: .many-linux
image: "quay.io/pypa/manylinux2014_x86_64"
parallel:
matrix:
- PYWHEEL: [8, 9]
COMPUTE: ["gpu", "cpu"]
FLAVOUR: ["2014"]
wheels-2_28:
extends: .many-linux
image: "quay.io/pypa/manylinux_2_28_x86_64"
before_script:
- dnf install -y libffi-devel
parallel:
matrix:
- PYWHEEL: [8, 9, 10, 11]
COMPUTE: ["gpu", "cpu"]
FLAVOUR: ["2_28"]
wheels-arm-2014:
extends: .many-linux
tags:
- arm64
image: quay.io/pypa/manylinux2014_aarch64
before_script:
# ARM CI image doesn't have git lfs, so need to jump some hoops
- yum install -y wget
- ROOT_DIR=$(pwd)
- mkdir git-lfs && cd git-lfs
&& wget https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-linux-arm64-v3.5.1.tar.gz
&& tar -xzvf git-lfs-linux-arm64-v3.5.1.tar.gz
&& cd git-lfs-3.5.1 && chmod +x install.sh && ./install.sh
- cd ${ROOT_DIR}
- GIT_SSL_NO_VERIFY=1 git lfs pull
# pytorch 2.3 wheel is busted with something looking like pytorch/issues/97226:
# we get Illegal instruction when running medaka counts test, so use 2.0.1 which
# is known to work
- sed -i '/^torch~=[^[:space:]]*/s/^torch~=[^[:space:]]*/torch==2.0.1/' requirements.txt
parallel:
matrix:
- PYWHEEL: [8, 9, 10]
COMPUTE: ["gpu"]
FLAVOUR: ["2014"]
###
# macOS wheels, note we don't take special care of macOS runtime version
#
.mac-wheel:
stage: build
script:
- echo "Building a wheel on macOS"
- arch; echo ""
- clang --version
- gcc --version
- python3 -m venv pypi_build --prompt "pypi"
- . ./pypi_build/bin/activate
- pip install cibuildwheel
- make scripts/mini_align
- CIBW_BUILD=cp3${PYWHEEL}-macosx_${arch} MACOSX_DEPLOYMENT_TARGET=12 CIBW_ENVIRONMENT="MEDAKA_LINK_ARGS='-L/opt/homebrew/lib' MEDAKA_DIST=1" cibuildwheel --output-dir wheelhouse-final
artifacts:
paths:
- wheelhouse-final/*.whl
parallel:
matrix:
# 8 gives grief with wanted to add -mtune=haswell \:D/
# suggests platform.machine() isn't reported correctly
- PYWHEEL: [9, 10, 11]
macOS-arm64-wheel:
extends: .mac-wheel
variables:
arch: arm64
tags:
- macos
- oxford
- arm
- shell
# macOS-x64-wheel:
# there's no pytorch macOS x64 wheels, so we don't build them
# Build conda packages but don't publish them
.before-conda: &before-conda |
export CONDA_PKG=${CI_PROJECT_NAME}
export CONDA_PKG_VERSION="dev"
cd conda
conda:
extends: .deploy-conda
stage: build
variables:
UPLOAD: "no"
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda
rules:
- if: $CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/
when: never
- if: $CI_PIPELINE_SOURCE == "push"
conda-arm:
extends: .deploy-conda-linux-arm
stage: build
variables:
UPLOAD: "no"
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda
rules:
- if: $CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/
when: never
- if: $CI_PIPELINE_SOURCE == "push"
conda-mac-arm:
extends: .deploy-conda-mac-arm
stage: build
variables:
UPLOAD: "no"
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda
rules:
- if: $CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/
when: never
- if: $CI_PIPELINE_SOURCE == "push"
###
# Deploy stages
#
# Send all tags to PyPI
push-pypi:
stage: release
<<: *minimal-python
script:
- make pypi_build/bin/activate
- source pypi_build/bin/activate
- twine upload dist/*.tar.gz wheelhouse-final/*.whl
only:
- tags
artifacts:
# just gathered together for easy inspection
paths:
- dist/*.tar.gz
- wheelhouse-final/*.whl
.setup-gh-push:
before_script:
- apt-get update -qq && apt-get install -y -qq
git python3-all-dev python3-venv git-lfs
- mkdir ~/.ssh/
- cp $RESEARCH_BOT_GH_KEY ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n\tHostname ssh.github.com\n\tPort 443\n\n" > ~/.ssh/config
- git config --global user.email "research.git@nanoporetech.com"
- git config --global user.name "ontresearch"
- git remote add ont ${CI_REPOSITORY_URL} || true
- git remote add github git@github.com:nanoporetech/${CI_PROJECT_NAME}.git || true
- git fetch ont dev --tags
# Send all tags matching vX.Y.Z to github (code and release)
push-github:
stage: release
extends: .setup-gh-push
script:
# Push master and tag to github
- git checkout ${CI_COMMIT_TAG}
- git branch -D master || echo "No master branch to delete"
- git fetch github
- git checkout -b master
- git push -f github master
- git push github ${CI_COMMIT_TAG}
# Make a github release page
- python3 -m venv release_env --prompt "(release) "
- source release_env/bin/activate
- pip install pip --upgrade
- pip install git+https://github.com/epi2me-labs/github_release.git
- github_release ${CI_PROJECT_NAME} ${CI_COMMIT_TAG} CHANGELOG.md ${RESEARCH_BOT_GH_TOKEN} --artifacts dist/*.tar.gz
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'
# Deploy to conda - need to rebuild because the template code
# is a one step build and push, for reasons...
# we override the rule so that we can push pre-release versions
.before-conda-tag: &before-conda-tag |
export CONDA_PKG=${CI_PROJECT_NAME}
export CONDA_PKG_VERSION=${CI_COMMIT_TAG/v/}
cd conda
push-conda:
extends: .deploy-conda
variables:
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda-tag
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(\S+)?$/'
push-conda-arm:
extends: .deploy-conda-linux-arm
variables:
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda-tag
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(\S+)?$/'
push-conda-mac-arm:
extends: .deploy-conda-mac-arm
variables:
USE_ORG_CHANNEL: "yes"
before_script:
- *before-conda-tag
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(\S+)?$/'