-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
217 lines (191 loc) · 6.41 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
# This script is an edited version of the example found at
# https://git.ligo.org/lscsoft/example-ci-project/blob/python/.gitlab-ci.yml
# Each 0th-indendation level is a job that will be run within GitLab CI
# The only exception are a short list of reserved keywords
#
# https://docs.gitlab.com/ee/ci/yaml/#gitlab-ci-yml
# stages is a reserved keyword that defines job dependencies and
# parallelization. each stage runs in parallel but must complete
# before the next stage begins
stages:
- test
- deploy
cache:
paths:
- .pip37
- .pip36
precommits-py3.7:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip install --upgrade pip
- pip --cache-dir=.pip37 install --upgrade bilby
- pip --cache-dir=.pip37 install .
- pip --cache-dir=.pip37 install pre-commit
# Run precommits (black, flake8, spellcheck, isort, no merge conflicts, etc)
- pre-commit run --all-files --verbose --show-diff-on-failure
python-3.7:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip install --upgrade pip
- pip --cache-dir=.pip37 install --upgrade bilby
- pip --cache-dir=.pip37 install .
- test -z ${CONDA_PREFIX} && pip list installed || conda list
# Run tests and collect coverage data
- pytest --cov bilby_pipe
- coverage html
- coverage-badge -o coverage_badge.svg -f
artifacts:
paths:
- htmlcov/
- coverage_badge.svg
# Test that the examples build properly
example-ini-file-builds:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip --cache-dir=.pip37 install --upgrade bilby
- pip --cache-dir=.pip37 install .
- cd examples/event
- bilby_pipe GW150914.ini
- cd outdir_GW150914/
- bilby_pipe GW150914_config_complete.ini --overwrite-outdir # Check that the completed config file compiles
- cd ../../gaussian_noise
- bilby_pipe *ini
- cd ../injection
- bilby_pipe *ini
- cd ../gps_times
- bilby_pipe gps_times_from_file.ini
- bilby_pipe gps_times_from_tuple.ini
- cd ../slurm
- bilby_pipe slurm_GW150914.ini
# Test that the examples build properly
injection-regression-test:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip --cache-dir=.pip37 install --upgrade bilby
- pip --cache-dir=.pip37 install .
- cd tests_ini_files/
- bilby_pipe test_gaussian_noise_simulation_and_injection.ini --local --bilby-test-mode
- bilby_pipe test_gaussian_noise_simulation.ini --local --bilby-test-mode
- bilby_pipe_create_injection_file --prior-file ../tests/injection_prior.prior -n 1 -f injection_test.dat
- if [[ ! -f injection_test.dat ]] ; then exit 1; else echo "Injection file exists"; fi
# Test that the review tests build properly
review-test-build:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip --cache-dir=.pip37 install --upgrade bilby
- pip --cache-dir=.pip37 install .
- mkdir TEST_REVIEW_FILES
- cd TEST_REVIEW_FILES
- bilby_pipe_review --prior 4s --bbh --marginalization distance phase --nact 5 --directory TEST
- if [[ ! -f TEST/review_fiducial_bbh_4s_dynesty_distance-phase_nact5.ini ]] ; then exit 1; else echo "Webpage exists"; fi
- bilby_pipe_review --prior 4s --pp-test --marginalization distance phase --sampler cPnEst --nact 5 --directory TEST
- if [[ ! -f TEST/review_pp_test_4s_cpnest_distance-phase_nact5.ini ]] ; then exit 1; else echo "Webpage exists"; fi
- cd ..
- rm TEST_REVIEW_FILES -r
#example-ini-file-pesummary:
# stage: test
# image: quay.io/bilbydev/bilby_pipe-test-suite-python37
# script:
# - source activate python37
# - pip install --upgrade bilby pesummary seaborn>=0.11
# - pip install .
# - cd tests/
# - bilby_pipe test_pesummary.ini --local --bilby-test-mode
# - exit
example-ini-file-gracedb:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
only:
- schedules
script:
- source activate python37
- pip install --upgrade bilby pesummary
- pip install .
- bilby_pipe_gracedb --json examples/gracedb/G298936.json --local --bilby-test-mode --output full-submit --sampler-kwargs FastTest --n-parallel 1
- if [[ ! -f outdir_G298936/results_page/home.html ]] ; then exit 1; else echo "Webpage exists"; fi
python-3.6:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python36
script:
- source activate python36
- mkdir -p .pip36
- pip install --upgrade pip
- pip --cache-dir=.pip36 install --upgrade bilby
- pip --cache-dir=.pip36 install .
- test -z ${CONDA_PREFIX} && pip list installed || conda list
# run tests
- pytest
documentation:
stage: test
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
script:
- source activate python37
- mkdir -p .pip37
- pip --cache-dir=.pip37 install .
# Make the documentation
- apt-get update
- apt-get -y install graphviz
# Sphinx-multiversion needs to be run on the git repo itself
- cd ../
- rm bilby_pipe/ -r
- git clone https://git.ligo.org/lscsoft/bilby_pipe.git
- cd bilby_pipe/
# Installation and clean up
- cd docs
- pip install -r requirements.txt
- make clean
- bilby_pipe_write_default_ini default.ini
- bilby_pipe_gracedb --json ../examples/gracedb/G298936.json --output ini --outdir .
# Sphinx-multiversion needs to be run from the top-level
- cd ..
- git fetch origin master
- git status
- git branch
- sphinx-multiversion docs/ docs/_build/
artifacts:
paths:
- docs/_build/
pages:
stage: deploy
dependencies:
- python-3.7
- documentation
script:
- mkdir public/
- mv htmlcov/ public/
- mv /builds/lscsoft/bilby_pipe/coverage_badge.svg public/
- mv docs/_build/* public/
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
deploy_release:
stage: deploy
image: quay.io/bilbydev/bilby_pipe-test-suite-python37
variables:
TWINE_USERNAME: $PYPI_USERNAME
TWINE_PASSWORD: $PYPI_PASSWORD
before_script:
- pip install twine
- python setup.py sdist
script:
- twine upload dist/*
only:
- tags