-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
205 lines (189 loc) · 5.16 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
stages:
- initial
- test
- wheels
- deploy
variables:
PRIMARY_VERSION: "3.11"
IMAGE_ROOT: "python"
PRIMARY_IMAGE: $IMAGE_ROOT:$PRIMARY_VERSION
.install-local: &install-local
- python -m pip install --debug -vv -e .
.build-wheel: &build-wheel
- python -m pip wheel -v --wheel-dir=wheel --no-deps .
.basic-tests: &basic-tests
- python -m pip show bilby.cython
- python -m pip check bilby.cython
- python -c "import bilby_cython"
- python -c "from bilby_cython import geometry"
- python -c "from bilby_cython import time"
basic:
stage: initial
image: $PRIMARY_IMAGE
before_script:
- python -m pip install --upgrade pip setuptools
script:
- *install-local
- *basic-tests
unit-tests:
stage: test
parallel:
matrix:
- PY_VERSION: [ "3.9", "3.10", "3.11", "3.12" ]
image: $IMAGE_ROOT:$PY_VERSION
before_script:
- python -m pip install --upgrade pip setuptools
- python -m pip install Cython numpy
- python -m pip install pytest-cov
- python -m pip install bilby
- python -m pip install lalsuite astropy
script:
- export CYTHON_COVERAGE=1
- *install-local
- python -m pytest --pyargs bilby_cython.test --cov=bilby_cython
after_script:
- coverage html
- mv htmlcov htmlcov_$PY_VERSION
- coverage xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- htmlcov_$PY_VERSION/
- coverage.xml
expire_in: 30 days
pages:
stage: test
image: $PRIMARY_IMAGE
before_script:
- python -m pip install --upgrade pip setuptools
- python -m pip install Cython numpy
- python -m pip install nbsphinx numpydoc sphinx-tabs sphinx_rtd_theme
- python -m pip install -e .
script:
- cd docs
- make clean
- make html
- cd ..
- mv docs/_build/html public
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
- tags
- schedules
# do some simple sanity checks in a virtualenv
.wheel-test: &wheel-test
- rm -rf wheel/build/
# install wheel
- ${PYTHON} -m venv test
- source test/bin/activate
# test with the most recent version of numpy
- python -m pip install --upgrade pip setuptools numpy
# change directory to ensure bilby_cython is not in the path twice
- cd wheelhouse
- python -m pip install *
- *basic-tests
.setup-build-env: &setup-build-env
- ${PYTHON} -m venv env
- source env/bin/activate
- python -m pip install --upgrade pip setuptools wheel build $FIXER
# build with oldest supported version of numpy for the python version
- python -m pip install oldest-supported-numpy Cython
# job template for wheel builds
.wheel:
stage: wheels
parallel:
matrix:
- PY_VERSION: [ "39", "310", "311", "312" ]
except:
variables:
# allow these jobs to be skipped by including
# `[skip wheels]` in the commit message
- $CI_COMMIT_MESSAGE =~ /\[skip wheels\]/
artifacts:
expire_in: 18h
paths:
- wheelhouse
# Build receipe for standalone wheels on Linux
.wheel:manylinux:
extends:
- .wheel
variables:
FIXER: auditwheel
before_script:
- export PYTHON="/opt/python/cp${PY_VERSION}-cp${PY_VERSION}/bin/python"
- *setup-build-env
script:
- *build-wheel
# Bundle and fix up dependent shared libraries
- auditwheel repair wheel/bilby.cython*.whl
- *wheel-test
# Build receipe for standalone wheels on macOS
wheel:macosx:
extends:
- .wheel
tags:
- macos_monterey_x86_64
variables:
FIXER: delocate
before_script:
- . /opt/local/share/macports/setupenv.bash
- PYTHON=$(which python$(echo ${CI_JOB_NAME} | sed 's/.*\[\([0-9]\)\([0-9]\{1,\}\).*/\1.\2/'))
- *setup-build-env
script:
- *build-wheel
# Bundle and fix up dependent shared libraries
- delocate-wheel -v -w wheelhouse wheel/bilby.cython*.whl
- *wheel-test
only:
# don't run macos wheel jobs from manually-triggered pipelines
- tags
- schedules
# Build wheels for all supported platforms
wheel:manylinux2014:
extends:
- .wheel:manylinux
image: quay.io/pypa/manylinux2014_x86_64
build-dist:
stage: wheels
image: $PRIMARY_IMAGE
except:
variables:
# allow these jobs to be skipped by including
# `[skip wheels]` in the commit message
- $CI_COMMIT_MESSAGE =~ /\[skip wheels\]/
before_script:
- export PYTHON=python
- *setup-build-env
script:
- python -m build . --sdist
- python -m pip install --debug -vv dist/*
# import tests won't work in the base directory as we don't build in place
- cd ../
- *basic-tests
artifacts:
expire_in: 18h
paths:
- dist
pypi-release:
stage: deploy
image: $PRIMARY_IMAGE
needs:
- build-dist
- wheel:manylinux2014
- wheel:macosx
before_script:
# exit if we're not running in the main namespace
- if [[ ${CI_PROJECT_PATH} != "colm.talbot/bilby-cython" ]]; then echo "Not deploying."; exit 0; fi
- python -m pip install --upgrade pip setuptools
- python -m pip install twine
script:
- twine upload --verbose --skip-existing wheelhouse/* dist/*
only:
- tags