forked from nanoporetech/medaka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
199 lines (166 loc) · 5.33 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
image: ${UBUNTU_IMAGE}:20.04
stages:
- test
- build
- deploy
# 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
# medaka test suite on various Pythons
.pytest: &pytest
<<: *preparetest
script:
- make test
# Latest versions as of 2023/02/10
test-3.7.16:
variables:
PYENV_VERSION: 3.7.16
<<: *pytest
test-3.8.16:
variables:
PYENV_VERSION: 3.8.16
<<: *pytest
test-3.9.16:
variables:
PYENV_VERSION: 3.9.16
<<: *pytest
test-3.10.10:
variables:
PYENV_VERSION: 3.10.10
<<: *pytest
test-mem-check:
variables:
PYENV_VERSION: 3.8.7
<<: *preparetest
script:
- make mem_check
###
# Source distribution
#
build:sdist:
stage: test
<<: *minimal-python
script:
- make sdist
artifacts:
paths:
- dist/*.tar.gz
###
# Many linux builds
#
.many-linux:
stage: build
variables:
DO_COUNT_TEST: 1
script:
- echo "Building a Python ${PYWHEEL} wheel on manylinux_${FLAVOUR} for ${COMPUTE}"
# this is still required, because otherwise test in build-wheel
# will first install tensorflow, then try to install tensorflow-cpu
# and complain
- if [[ "${COMPUTE}" == "cpu" ]]; then export PACKAGE_NAME=medaka-cpu; export MEDAKA_CPU=1; sed -i "s/tensorflow/tensorflow-cpu/" requirements.txt; fi
- ./build-wheels.sh . ${PYWHEEL}
artifacts:
paths:
- wheelhouse-final/*.whl
#only:
#- tags
wheels-2014:
extends: .many-linux
image: "quay.io/pypa/manylinux2014_x86_64"
parallel:
matrix:
- PYWHEEL: [7, 8, 9]
COMPUTE: ["gpu", "cpu"]
FLAVOUR: ["2014"]
wheels-2_28:
extends: .many-linux
image: "quay.io/pypa/manylinux_2_28_x86_64"
parallel:
matrix:
- PYWHEEL: [8, 9, 10]
COMPUTE: ["gpu", "cpu"]
FLAVOUR: ["2_24"]
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
- 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
parallel:
matrix:
- PYWHEEL: [8, 9, 10]
COMPUTE: ["gpu"]
FLAVOUR: ["2014"]
###
# 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-final/*.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 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:]]+$/'