-
Notifications
You must be signed in to change notification settings - Fork 11
346 lines (287 loc) · 9.09 KB
/
pypi.yaml
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
name: Publish
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CP2K_VERSION: "2023.1"
TAG: "3.2.0" # The nlesc-nano/nano-qmflows-manylinux tag
PY_COLORS: "1"
jobs:
build_wheels:
name: Build wheels cp39-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64]
- [ubuntu-latest, manylinux_aarch64]
- [macos-latest, macosx_x86_64]
- [macos-latest, macosx_arm64]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
if: matrix.buildplat[1] == 'manylinux_aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Get MacOS build dependencies
if: matrix.buildplat[0] == 'macos-latest'
env:
BUILD_PLAT: ${{ matrix.buildplat[1] }}
run: |
curl -Lsf https://github.com/nlesc-nano/nano-qmflows-manylinux/releases/download/$TAG/$BUILD_PLAT.tar.gz -o $BUILD_PLAT.tar.gz
tar -xzf $BUILD_PLAT.tar.gz
cp -r $BUILD_PLAT/bin/* /usr/local/bin/
sudo cp -r $BUILD_PLAT/lib/* /usr/local/lib/
cp -r $BUILD_PLAT/include/* /usr/local/include/
cp -r $BUILD_PLAT/share/* /usr/local/share/
- name: Enable aarch64/arm64 compilation
if: matrix.buildplat[1] == 'manylinux_aarch64' || matrix.buildplat[1] == 'macosx_arm64'
run: |
echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-${{ matrix.buildplat[1] }}
CIBW_MANYLINUX_AARCH64_IMAGE: "ghcr.io/nlesc-nano/manylinux2014_aarch64-qmflows:${{ env.TAG }}"
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/nlesc-nano/manylinux2014_x86_64-qmflows:${{ env.TAG }}"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
test_wheels_x86_64:
name: Test wheels ${{ matrix.version[0] }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
needs: [build_wheels]
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64, manylinux2014_x86_64]
- [macos-latest, macosx_x86_64, macosx_10_14_x86_64]
version:
- ["cp38", "3.8"]
- ["cp39", "3.9"]
- ["cp310", "3.10"]
- ["cp311", "3.11"]
- ["cp312", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.version[1] }}
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Install dependencies
run: |
WHL_NAME=$(python scripts/get_whl_name.py dist ${{ matrix.buildplat[2] }})
pip install "$WHL_NAME"[test] --prefer-binary
- name: Python info
run: |
which python
python --version
- name: Installed packages
run: pip list
- name: Install CP2K
run: |
case "${{ matrix.buildplat[0] }}" in
"ubuntu-latest")
bash scripts/download_cp2k.sh x86_64 $CP2K_VERSION ;;
"macos-latest")
brew update && brew install cp2k ;;
esac
- name: CP2K info
run: cp2k.ssmp --version
- name: Test with pytest
run: |
bash scripts/prepare_test_dir.sh
cd /tmp/nanoqm
case "${{ github.event_name }}" in
"release")
export IS_RELEASE=1 ;;
*)
export IS_RELEASE=0 ;;
esac
pytest -m "not (slow or long)"
test_wheels_aarch64:
name: Test wheels ${{ matrix.version[0] }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
needs: [build_wheels]
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_aarch64]
version:
- ["cp38", "python3.8"]
- ["cp39", "python3.9"]
- ["cp310", "python3.10"]
- ["cp311", "python3.11"]
- ["cp312", "python3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: uraimo/run-on-arch-action@v2
name: Test with pytest
with:
arch: aarch64
distro: ubuntu_latest
dockerRunArgs: |
--volume "${{github.workspace}}:/workspace"
--env CP2K_VERSION=${CP2K_VERSION}
install: |
echo "\n::group::Install Python"
apt update
apt install -y software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt install -y ${{ matrix.version[1] }}-full
ln -sf /usr/bin/${{ matrix.version[1] }} /usr/bin/python
ln -sf /usr/bin/${{ matrix.version[1] }} /usr/bin/python3
export PYTHONPATH=/usr/bin/${{ matrix.version[1] }}
echo "\n::group::Install pip"
apt install -y python3-pip
echo "\n::group::Install curl"
apt install -y curl
run: |
cd /workspace
echo "\n::group::Install CP2K"
bash scripts/download_cp2k.sh aarch64 $CP2K_VERSION
echo "\n::group::Install the package"
WHL_NAME=$(python scripts/get_whl_name.py dist manylinux2014_aarch64)
pip install $WHL_NAME[test] --prefer-binary
echo "\n::group::Python info"
python --version
pip list
echo "\n::group::Run tests"
bash scripts/prepare_test_dir.sh
cd /tmp/nanoqm
case "${{ github.event_name }}" in
"release")
export IS_RELEASE=1 ;;
*)
export IS_RELEASE=0 ;;
esac
pytest -m "not (slow or long)"
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
env:
QMFLOWS_INCLUDEDIR: ""
QMFLOWS_LIBDIR: ""
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: pip install build
- name: Python info
run: |
which python
python --version
- name: Installed packages
run: pip list
- name: Build sdist
run: |
python -m build --sdist
tree dist
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.tar.gz
test_sdist:
name: Test sdist
runs-on: ubuntu-latest
needs: [build_sdist]
steps:
- uses: actions/checkout@v4
- name: Install CP2K
run: bash scripts/download_cp2k.sh x86_64 $CP2K_VERSION
- name: Info CP2K
run: cp2k.ssmp --version
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Install dependencies
run: |
conda install -c conda-forge pip boost eigen "libint>=2.6.0" highfive
TGZ_NAME=$(python scripts/get_whl_name.py dist 'tar\.gz')
pip install $TGZ_NAME[test]
- name: Conda info
run: conda info
- name: Conda list
run: conda list
- name: Test with pytest
run: |
bash scripts/prepare_test_dir.sh
cd /tmp/nanoqm
case "${{ github.event_name }}" in
"release")
export IS_RELEASE=1 ;;
*)
export IS_RELEASE=0 ;;
esac
pytest -m "not (slow or long)"
upload_wheels:
name: Upload wheels & sdist
runs-on: ubuntu-latest
needs: [test_sdist, test_wheels_x86_64, test_wheels_aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.*"
- name: Install dependencies
run: pip install twine
- name: Python info
run: |
which python
python --version
- name: Installed packages
run: pip list
- name: Validate wheels
run: |
tree dist
twine check dist/*
- name: Publish wheels
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Attach wheels to GitHub release
if: github.event_name == 'release'
uses: AButler/[email protected]
with:
files: 'dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}