forked from nanoporetech/medaka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
268 lines (224 loc) · 6.67 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
image: $IMAGE
stages:
- test
- build
- deploy
variables:
DOCKERTAG: "medaka/medaka:latest"
# 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
libreadline7 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
# medaka test suite on various Pythons
.pytest: &pytest
<<: *preparetest
script:
- make test
test-3.7.9:
variables:
PYENV_VERSION: 3.7.9
<<: *pytest
test-3.8.7:
variables:
PYENV_VERSION: 3.8.7
<<: *pytest
test-3.9.9:
variables:
PYENV_VERSION: 3.9.9
<<: *pytest
test-mem-check:
variables:
PYENV_VERSION: 3.8.7
<<: *preparetest
script:
- make mem_check
test-docker:
image: ${DOCKERDEV_IMAGE}
stage: test
script:
- apk --no-cache add make
- DOCKERTAG=$DOCKERTAG make docker
- docker run --rm -v $PWD:/data $DOCKERTAG medaka_consensus -x -i /data/medaka/test/data/test_reads.fasta.gz -d /data/medaka/test/data/draft_ref.fasta -o /data/dockertest
###
# Source distribution
#
build:sdist:
stage: build
<<: *minimal-python
script:
- make sdist
artifacts:
paths:
- dist/*.tar.gz
###
# Many linux builds
#
.many-linux: &many-linux-def
image: quay.io/pypa/manylinux2010_x86_64
stage: build
variables:
DO_COUNT_TEST: 1
artifacts:
paths:
- wheelhouse/*.whl
only:
- tags
.switch-to-cpu: &switch-to-cpu
before_script:
- export PACKAGE_NAME=medaka-cpu
- export MEDAKA_CPU=1
# this is still required, because otherwise test in build-wheel
# will first install tensorflow, then try to install tensorflow-cpu
# and complain
- sed -i 's/tensorflow/tensorflow-cpu/' requirements.txt
### Tensorflow (gpu) builds
gpu:many-linux-7:
<<: *many-linux-def
script:
- ./build-wheels.sh . 7
gpu:many-linux-8:
<<: *many-linux-def
script:
- ./build-wheels.sh . 8
gpu:many-linux-9:
<<: *many-linux-def
script:
- ./build-wheels.sh . 9
gpu:many-linux-8:branch:
extends: gpu:many-linux-8
only:
- branches
### Tensorflow-cpu wheels
cpu:many-linux-7:
<<: *many-linux-def
<<: *switch-to-cpu
script:
- ./build-wheels.sh . 7
cpu:many-linux-8:
<<: *many-linux-def
<<: *switch-to-cpu
script:
- ./build-wheels.sh . 8
cpu:many-linux-9:
<<: *many-linux-def
<<: *switch-to-cpu
script:
- ./build-wheels.sh . 9
###
# ARM builds
#
.arm-many-linux: &arm-many-linux-def
image: quay.io/pypa/manylinux2014_aarch64
stage: build
tags:
- arm64
variables:
DO_COUNT_TEST: 0
before_script:
# ARM CI image doesn't have git lfs, so need to jump some hoops
- yum install -y wget
- mkdir git-lfs && cd git-lfs
&& wget https://github.com/git-lfs/git-lfs/releases/download/v2.12.0/git-lfs-linux-arm64-v2.12.0.tar.gz
&& tar -xzvf git-lfs-linux-arm64-v2.12.0.tar.gz
&& chmod +x install.sh && ./install.sh
&& cd ..
- GIT_SSL_NO_VERIFY=1 git lfs pull
artifacts:
paths:
- wheelhouse/*.whl
only:
- tags
arm-many-linux-7:
<<: *arm-many-linux-def
script:
- ./build-wheels.sh . 7
arm-many-linux-8:
<<: *arm-many-linux-def
script:
- ./build-wheels.sh . 8
arm-many-linux-9:
<<: *arm-many-linux-def
script:
- ./build-wheels.sh . 9
arm-many-linux:branch:
extends: arm-many-linux-8
only:
- branches
###
# Deploy stages
#
# Send all tags to PyPI
deploy:pypi:
stage: deploy
<<: *minimal-python
script:
- make pypi_build/bin/activate
- source pypi_build/bin/activate
- twine upload dist/*.tar.gz wheelhouse/*.whl
only:
- tags
.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 "[email protected]"
- git config --global user.name "ontresearch"
- git remote add ont ${CI_REPOSITORY_URL} || true
- git remote add github [email protected]: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: deploy
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 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:]]+$/'
push-dockerhub:
image: ${DOCKERDEV_IMAGE}
stage: deploy
script:
- apk --no-cache add make
- echo ${DOCKERHUB_TOKEN} | docker login --username ${DOCKERHUB_USER} --password-stdin
- DOCKERTAG=$DOCKERTAG make docker
- LATEST="ontresearch/medaka:latest"
- TAG="ontresearch/medaka:$CI_COMMIT_TAG"
- docker tag $DOCKERTAG $LATEST
- docker tag $DOCKERTAG $TAG
- docker push ${LATEST}
- docker push ${TAG}
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'