-
Notifications
You must be signed in to change notification settings - Fork 21
/
config.yml
331 lines (278 loc) · 9.1 KB
/
config.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
version: 2.1
commands:
set-env:
description: "Set environment variables."
steps:
- run:
name: "Set environment variables."
command: |
echo 'export GOLD_STANDARD=HEAD' >> $BASH_ENV
echo 'export ROCKSTAR_DIR=$HOME/rockstar-galaxies' >> $BASH_ENV
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROCKSTAR_DIR' >> $BASH_ENV
echo 'export YT_DATA=$HOME/yt_test' >> $BASH_ENV
echo 'export TEST_DIR=$HOME/test_results' >> $BASH_ENV
echo 'export TEST_NAME=astro_analysis' >> $BASH_ENV
echo 'export TEST_FLAGS="--nologcapture -v --with-answer-testing --local --local-dir $TEST_DIR --answer-name=$TEST_NAME --answer-big-data"' >> $BASH_ENV
install-dependencies:
description: "Install dependencies."
steps:
- run:
name: "Install dependencies."
command: |
sudo apt update
sudo apt upgrade
sudo apt install -y dvipng texlive-latex-extra
python3 -m venv $HOME/venv
source $HOME/venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r test_requirements.txt
install-with-yt-dev:
description: "Install dependencies with yt from source."
steps:
- run:
name: "Install dependencies with yt from source."
command: |
source $BASH_ENV
sudo apt update
sudo apt upgrade
sudo apt install -y dvipng texlive-latex-extra
sudo apt install -y libopenmpi-dev openmpi-bin gcc-9
python3 -m venv $HOME/venv
source $HOME/venv/bin/activate
pip install --upgrade pip
pip install mpi4py
export MAX_BUILD_CORES=2
python -m pip install git+https://github.com/yt-project/yt
export YT_ASTRO_DIR=$(pwd)
# install rockstar
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
if [ ! -f $ROCKSTAR_DIR/VERSION ]; then
git clone https://bitbucket.org/pbehroozi/rockstar-galaxies $ROCKSTAR_DIR
pushd $ROCKSTAR_DIR
# apply patches necessary for compat with Ubuntu 22.04
git apply $YT_ASTRO_DIR/rockstar-patches/cflags.patch --whitespace=fix
make lib
popd
fi
echo $ROCKSTAR_DIR > rockstar.cfg
# never attempt to build h5py from source
pip install h5py --only-binary h5py
# install yt_astro_analysis with extra dev dependencies
pip install .[dev]
# configure yt
mkdir -p $HOME/.config/yt # avoid a warning from yt
yt config set --global yt suppress_stream_logging True
yt config set --global yt test_data_dir $YT_DATA
yt config set --global yt log_level 30
download-test-data:
description: "Download test data."
steps:
- run:
name: "Download test data."
no_output_timeout: 20m
command: |
if [ ! -f $YT_DATA/enzo_tiny_cosmology/DD0046/DD0046 ]; then
source $BASH_ENV
source $HOME/venv/bin/activate
mkdir -p $YT_DATA
girder-cli --api-url https://girder.hub.yt/api/v1 download 577c09480d7c6b0001ad5be2 $YT_DATA/enzo_tiny_cosmology
fi
build-and-test-nose:
description: "Build yt_astro_analysis and run tests (nose)."
steps:
- run:
name: "Build yt_astro_analysis and run tests."
command: |
# tag the tip so we can get back there
git tag tip
source $BASH_ENV
source $HOME/venv/bin/activate
# generate answers if not cached
if [ ! -f ${TEST_DIR}/${TEST_NAME}/${TEST_NAME} ]; then
git checkout $GOLD_STANDARD
python -m pip install -e .
nosetests $TEST_FLAGS --answer-store
fi
# return to tip and run comparison tests
git checkout tip
python -m pip install -e .
coverage run `which nosetests` $TEST_FLAGS
# code coverage report
codecov
build-and-test-pytest:
description: "Build yt_astro_analysis and run tests (pytest)."
steps:
- run:
name: "Build yt_astro_analysis and run tests."
command: |
source $BASH_ENV
source $HOME/venv/bin/activate
python -m pip install -e .
pytest
build-docs:
description: "Test the docs build."
steps:
- run:
name: "Test the docs build."
command: |
source $HOME/venv/bin/activate
cd doc/source
python -m pip ../install requirements.txt
python -m sphinx -M html "." "_build" -W
executors:
python:
parameters:
tag:
type: string
default: latest
docker:
- image: cimg/python:<< parameters.tag >>
jobs:
run-tests:
parameters:
tag:
type: string
default: latest
executor:
name: python
tag: << parameters.tag >>
working_directory: ~/yt_astro_analysis
steps:
- checkout
- set-env
- restore_cache:
name: "Restore dependencies cache."
key: python-<< parameters.tag >>-dependencies-bonxie
- install-with-yt-dev
- save_cache:
name: "Save dependencies cache"
key: python-<< parameters.tag >>-dependencies-bonxie
paths:
- ~/.cache/pip
- ~/venv
- ~/yt-git
- ~/rockstar-galaxies
- restore_cache:
name: "Restore test data cache."
key: test-data-bonxie
- download-test-data
- save_cache:
name: "Save test data cache."
key: test-data-bonxie
paths:
- ~/yt_test
- restore_cache:
name: "Restore test answers."
key: python-<< parameters.tag >>-test-answers-bonxie
- build-and-test-nose
- save_cache:
name: "Save test answers cache."
key: python-<< parameters.tag >>-test-answers-bonxie
paths:
- ~/test_results
run-tests-pytest:
# Run a subset of the test suite (yield-based tests are not supported by pytest)
# this is necessary to test in Python 3.10+ because it's not compatible with nose
parameters:
tag:
type: string
default: latest
executor:
name: python
tag: << parameters.tag >>
working_directory: ~/yt_astro_analysis
steps:
- checkout
- set-env
- restore_cache:
name: "Restore dependencies cache."
key: python-<< parameters.tag >>-dependencies-bonxie
- install-with-yt-dev
- save_cache:
name: "Save dependencies cache"
key: python-<< parameters.tag >>-dependencies-bonxie
paths:
- ~/.cache/pip
- ~/venv
- ~/yt-git
- ~/rockstar-galaxies
- restore_cache:
name: "Restore test data cache."
key: test-data-bonxie
- download-test-data
- save_cache:
name: "Save test data cache."
key: test-data-bonxie
paths:
- ~/yt_test
- restore_cache:
name: "Restore test answers."
key: python-<< parameters.tag >>-test-answers-bonxie-pytest
- build-and-test-pytest
- save_cache:
name: "Save test answers cache."
key: python-<< parameters.tag >>-test-answers-bonxie-pytest
paths:
- ~/test_results
docs-test:
parameters:
tag:
type: string
default: latest
executor:
name: python
tag: << parameters.tag >>
working_directory: ~/yt_astro_analysis
steps:
- checkout
- set-env
- restore_cache:
name: "Restore dependencies cache."
key: python-<< parameters.tag >>-dependencies-bonxie
- install-with-yt-dev
- save_cache:
name: "Save dependencies cache"
key: python-<< parameters.tag >>-dependencies-bonxie
paths:
- ~/.cache/pip
- ~/venv
- ~/yt-git
- ~/rockstar-galaxies
- build-docs
workflows:
version: 2
normal-tests:
jobs:
- run-tests:
name: "Python 3.8 tests"
tag: "3.8.9"
- run-tests:
name: "Python 3.9 tests"
tag: "3.9.7"
- run-tests-pytest:
name: "Python 3.10 tests"
tag: "3.10.0"
- run-tests-pytest:
name: "Python 3.11 tests"
tag: "3.11.1"
- docs-test:
name: "Test docs build"
tag: "3.9.7"
weekly:
triggers:
- schedule:
cron: "0 0 * * 2"
filters:
branches:
only:
- main
jobs:
- run-tests:
name: "Python 3.8 tests"
tag: "3.8.9"
- run-tests-pytest:
name: "Python 3.10 tests"
tag: "3.10.0"
- docs-test:
name: "Test docs build"
tag: "3.9.7"