forked from refnx/refnx
-
Notifications
You must be signed in to change notification settings - Fork 0
306 lines (248 loc) · 8.92 KB
/
pythonpackage.yml
File metadata and controls
306 lines (248 loc) · 8.92 KB
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
name: Lint + Test
on:
- push
- pull_request
jobs:
test_linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: setup apt dependencies
run: |
sudo apt-get update
sudo apt-get install xvfb qt5-default opencl-headers ocl-icd-opencl-dev libpocl2 libhdf5-serial-dev libnetcdf-dev
python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ hashFiles('setup.py') }}-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
- name: Test with pytest
env:
MPLBACKEND: agg
run: |
python -m pip install --upgrade pip
python -m pip install wheel
python -m pip install -e .[all]
python -m pip install pytest pyqt5==5.15.2 uncertainties pyopencl pymc3 pytest-qt
# uses xvfb for GUI part of the test
xvfb-run pytest
- name: Make sdist
if: ${{ matrix.python-version == '3.8' }}
run: |
git clean -xdf
python setup.py sdist
- uses: actions/upload-artifact@v1
if: ${{ matrix.python-version == '3.8' }}
with:
name: refnx-wheel
path: dist/
linux_wheels:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
PLAT: ["manylinux2014_x86_64"]
steps:
- uses: actions/checkout@v2
- name: Make Linux Wheel
run: |
docker run --rm -e="PLAT=${{ matrix.PLAT }}" -v $(pwd):/io quay.io/pypa/${{ matrix.PLAT }} /bin/bash /io/tools/build_manylinux_wheels.sh
- uses: actions/upload-artifact@v1
with:
name: refnx-wheel
path: dist/
test_macos:
runs-on: macos-latest
strategy:
max-parallel: 3
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: mkdir -p dist
- name: Install openmp
run: |
brew install libomp
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ hashFiles('setup.py') }}-macos-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
- name: Make wheel
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include"
CFLAGS: "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include"
LDFLAGS: "-L/usr/local/opt/libomp/lib -lomp"
DYLD_LIBRARY_PATH: /usr/local/opt/libomp/lib
run: |
python -m pip install --upgrade pip
python -m pip install wheel delocate
python -m pip wheel . --no-deps -w dist
# so that libomp is distributed with wheel
delocate-wheel -v dist/refnx*.whl
- name: Install package and test with pytest
env:
MPLBACKEND: agg
run: |
pushd dist
python -m pip install numpy scipy orsopy
python -m pip install --only-binary=refnx --no-index --find-links=. refnx
python -m pip install --upgrade --upgrade-strategy eager h5py pandas xlrd pytest ipywidgets IPython matplotlib traitlets pyqt5 uncertainties attrs corner tqdm periodictable pyopencl
# python -m pip install git+https://github.com/pymc-devs/pymc3
pytest --pyargs refnx
popd
- name: Make frozen GUI executable
if: ${{ matrix.python-version == '3.8' }}
run: |
# make app in virtualenv
python -m venv app
source app/bin/activate
python -m pip install --upgrade --upgrade-strategy eager -r tools/app/requirements.txt
# pin scipy 1.7.3 because of pyinstaller doesn't like arm64 bing in libgfortran.dylib
python -m pip install scipy==1.7.3
pushd dist
python -m pip install --only-binary=refnx --no-index --find-links=. refnx
popd
python -m pip install pyinstaller psutil
# compileall in an effort to speedup pyinstaller GUI start
python -m compileall
pushd tools/app
pyinstaller motofit.spec
# check to see that the app starts
python check_app_starts.py dist/motofit.app/Contents/MacOS/motofit
zip -r -X dist/motofit.app.zip dist/motofit.app/
mv dist/motofit.app.zip ../../dist/
popd
- uses: actions/upload-artifact@v1
with:
name: refnx-wheel
path: dist/
test_win:
runs-on: windows-latest
strategy:
max-parallel: 3
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: mkdir -p dist
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ hashFiles('setup.py') }}-win-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
- name: Make wheel
run: |
python -m pip install --upgrade pip
python -m pip install wheel
python -m pip wheel . --no-deps -w dist
- name: Install package and test with pytest
if: ${{ matrix.python-version == '3.8' }}
env:
PYOPENCL_CTX: 0
run: |
cd dist
python -m pip install numpy scipy orsopy
python -m pip install --only-binary=refnx --no-index --find-links=. refnx
python -m pip install --upgrade --upgrade-strategy eager h5py cython pandas xlrd pytest ipywidgets IPython matplotlib traitlets pyqt5 uncertainties corner tqdm periodictable pytest-qt
# python -m pip install git+https://github.com/pymc-devs/pymc3
# python -m pip install pytools mako cffi
# choco install opencl-intel-cpu-runtime
# python -m pip install --only-binary=pyopencl --find-links http://www.silx.org/pub/wheelhouse/ --trusted-host www.silx.org pyopencl
pytest --pyargs refnx
cd ..
# - name: Make frozen GUI executable
# if: ${{ matrix.python-version == '3.8' }}
# run: |
# # make app in virtualenv
# python -m venv app
# app\Scripts\activate.bat
# python -m pip install setuptools==44
# python -m pip install --upgrade --upgrade-strategy eager numpy cython periodictable corner matplotlib pyqt5 scipy
# cd dist
# python -m pip install --only-binary=refnx --no-index --find-links=. refnx
# cd ..
#
# # fix for multiprocessing on Py3.8 is not merged in PyInstaller
# # if you are on Py3.7 you can just pip install pyinstaller
# pip install git+https://github.com/andyfaff/pyinstaller.git@gh4865
#
# cd tools\app
# pyinstaller motofit.spec
# move dist\motofit.exe ..\..\dist\
# cd ..\..
- uses: actions/upload-artifact@v1
with:
name: refnx-wheel
path: dist/
build_doc:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: setup apt dependencies
run: |
sudo apt-get update
sudo apt-get install pandoc
- name: Build documentation
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install wheel
cd doc
python -m pip install -r requirements.txt
make html
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8 and black
run: |
python -m pip install flake8 black
# stop the build if there are Python syntax errors or undefined names
# the ignores are taken care of by black
flake8 --ignore=F401,E501,W504,W503,E203,E231 --count --show-source --statistics --exclude=refnx/_lib/emcee,refnx/reflect/_app/resources_rc.py,refnx/_lib/ptemcee refnx
black --check --exclude="refnx/_lib/emcee/|refnx/_lib/ptemcee/" refnx -l 79