-
Notifications
You must be signed in to change notification settings - Fork 4
211 lines (192 loc) · 6.55 KB
/
tests+pypi.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
name: tests+pypi
defaults:
run:
shell: bash
env:
arbitrarily_selected_artefact_set: '3.10/ubuntu-latest/0/openmpi'
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
release:
types: [published]
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Linting
run: |
pip install pre-commit
pre-commit clean
pre-commit autoupdate
pre-commit run --all-files
pdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- uses: mpi4py/setup-mpi@v1
- name: Build
run: |
pip install pdoc3
pip install -e .
python -We -m pdoc --html PyMPDATA_MPI
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
BRANCH: pdoc
FOLDER: html/PyMPDATA_MPI
CLEAN: true
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mpi4py/setup-mpi@v1
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pylint pytest matplotlib
- name: Analysing the code with pylint
run: |
pylint --unsafe-load-any-extension=y --disable=fixme $(git ls-files '*.py')
tests:
needs: [pylint, pdoc, precommit]
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
mpi: [ 'mpich', 'openmpi', 'intelmpi']
python-version: ["3.10"]
disable-jit: [1, 0]
mpi-np: [1, 2, 3, 4]
exclude:
# as of time of writing, mpi4py/setup-mpi does not support it
- platform: macos-latest
mpi: intelmpi
# issues with: *** The MPI_Comm_rank() function was called before MPI_INIT was invoked.
- platform: ubuntu-latest
mpi: intelmpi
# https://github.com/Homebrew/homebrew-core/issues/26974
- platform: macos-latest
mpi: mpich
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi }}
- if: matrix.mpi == 'mpich'
run: echo _ch="ch" >> $GITHUB_ENV
- if: startsWith(matrix.platform, 'ubuntu-')
run: sudo apt-get update && sudo apt-get install -y libhdf5-mpi$_ch-dev pkg-config
- if: startsWith(matrix.platform, 'ubuntu-') && matrix.mpi == 'mpich'
run: |
echo HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu/hdf5/mpich >> $GITHUB_ENV
echo HDF5_INCLUDEDIR=/usr/include/hdf5/mpich >> $GITHUB_ENV
- if: startsWith(matrix.platform, 'macos-')
run: brew install hdf5-mpi && echo HDF5_DIR=/opt/homebrew >> $GITHUB_ENV
- run: HDF5_MPI="ON" CC=mpicc pip install --no-binary=h5py "git+https://github.com/h5py/h5py@81f6c01#egg=h5py"
- run: pip install -e .
- run: python -We -c "import PyMPDATA_MPI"
- run: pip install pytest pytest-timeout pytest-mpi matplotlib
- if: matrix.mpi == 'openmpi'
run: echo _mpiexec_args="--oversubscribe" >> $GITHUB_ENV
- name: "mpiexec pytest"
env:
NUMBA_DISABLE_JIT: ${{ matrix.disable-jit }}
run: |
if [ "$arbitrarily_selected_artefact_set" == "${{ matrix.python-version }}/${{ matrix.platform }}/${{ matrix.disable-jit }}/${{ matrix.mpi }}" ]; then
export CI_PLOTS_PATH=plots/$arbitrarily_selected_artefact_set
mkdir -p $CI_PLOTS_PATH
fi
mpiexec $_mpiexec_args -n ${{ matrix.mpi-np }} pytest --timeout=600 --timeout_method=thread -s -vv -We tests/unit_tests;
- uses: actions/upload-artifact@v2
with:
name: plots
path: plots
dist:
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- run: pip install twine build
- run: |
unset CI
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | wc -l`
- run: twine check --strict dist/*
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
devops_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- run: pip install -r tests/devops_tests/requirements.txt
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pytest --durations=10 -v -s -We -p no:unraisableexception tests/devops_tests
tip-release-uploads:
runs-on: ubuntu-latest
needs: [tests, devops_tests]
steps:
- uses: actions/download-artifact@v2
with:
name: plots
path: plots
- run: |
sudo apt install -y librsvg2-bin
for path in plots/${{ env.arbitrarily_selected_artefact_set }}/*; do
for file in $path/*.svg; do
rsvg-convert $file -o tmp.png
convert tmp.png -flatten -trim +repage -bordercolor white -border 10 $file.png
done;
rm tmp.png
convert $path/*.png plots/`basename $path`-anim.gif
done;
- uses: actions/upload-artifact@v2
with:
name: anims
path: plots/*-anim.gif
- if: github.ref == 'refs/heads/main'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: plots/*-anim.gif
tag: 'latest-generated-plots'