-
Notifications
You must be signed in to change notification settings - Fork 47
423 lines (409 loc) · 13.8 KB
/
release.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
name: Release
on:
release:
types:
- created
push:
branches:
- 'wheel/**'
jobs:
build_Linux_wheels:
name: Build manylinux
runs-on: ubuntu-22.04
strategy:
matrix:
python3-version: ['9', '10', '11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_x86_64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run build
run: |
docker start linux_build
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
mkdir wheelhouse
docker cp linux_build:/tket/pytket/audited/. wheelhouse/
- uses: actions/upload-artifact@v3
with:
name: Linux_3.${{ matrix.python3-version }}_wheel
path: wheelhouse/
build_Linux_aarch64_wheels:
name: Build manylinux aarch64
runs-on: ['self-hosted', 'macOS', 'ARM64']
strategy:
matrix:
python3-version: ['9', '10', '11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up container
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_aarch64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run build
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker start linux_build
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
mkdir wheelhouse
docker cp linux_build:/tket/pytket/audited/. wheelhouse/
- name: Remove container
if: always()
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker rm --force -v linux_build
- uses: actions/upload-artifact@v3
with:
name: Linux_aarch64_3.${{ matrix.python3-version }}_wheel
path: wheelhouse/
- name: Remove directory
if: always()
run: rm -rf wheelhouse
build_macos_wheels:
name: Build macos wheels
runs-on: macos-11
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Set up conan
run: |
conan profile detect
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: Build tket C++
run: conan create tket --user tket --channel stable --build=missing -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
- name: Build wheel
run: |
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
# Ensure wheels are compatible with MacOS 10.14 and later:
export WHEEL_PLAT_NAME=macosx_10_14_x86_64
pip install -U pip build delocate
python -m build
delocate-wheel -v -w "$GITHUB_WORKSPACE/wheelhouse/" "dist/pytket-"*".whl"
- uses: actions/upload-artifact@v3
with:
name: MacOS_${{ matrix.python-version }}_wheel
path: wheelhouse/
build_macos_M1_wheels:
name: Build macos (M1) wheels
runs-on: ['self-hosted', 'macOS', 'ARM64']
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Uninstall conan
run: pip3 uninstall -y conan
- name: Build wheels
run: |
eval "$(pyenv init -)"
pyenv shell tket-${{ matrix.python-version }}
python -m pip install -U conan
conan profile detect --force
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --force --index 0
conan remove -c 'tket/*'
conan create tket --user tket --channel stable --build=missing -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
conan remove -c "pybind11/*"
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
# Ensure wheels are compatible with MacOS 11.0 and later:
export WHEEL_PLAT_NAME=macosx_11_0_arm64
conan remove -c "pytket/*"
python -m pip uninstall -y pytket
python -m pip install -U pip build delocate
rm -rf dist
python -m build
delocate-wheel -v -w "$GITHUB_WORKSPACE/wheelhouse/" "dist/pytket-"*".whl"
- uses: actions/upload-artifact@v3
with:
name: MacOS_M1_${{ matrix.python-version }}_wheel
path: wheelhouse/
- name: Remove directory
if: always()
run: rm -rf wheelhouse
build_Windows_wheels:
name: Build Windows wheels
runs-on: windows-2022
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Set up conan
run: |
conan profile detect
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: Build tket
run: conan create tket --user tket --channel stable --build=missing -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf `"`"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build wheel
run: |
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
python -m pip install -U pip build
python -m build --outdir "${{ github.workspace }}/wheelhouse"
- uses: actions/upload-artifact@v3
with:
name: Windows_${{ matrix.python-version }}_wheel
path: wheelhouse/
test_linux_wheels:
name: Test linux wheels
needs: build_Linux_wheels
runs-on: ubuntu-22.04
strategy:
matrix:
python3-version: ['9', '10', '11']
steps:
- name: Set up Python 3.${{ matrix.python3-version }}
uses: actions/setup-python@v4
with:
python-version: "3.${{ matrix.python3-version }}"
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: Linux_3.${{ matrix.python3-version }}_wheel
path: wheelhouse/
- name: Install wheel
run: pip install wheelhouse/pytket-*.whl
- uses: actions/checkout@v3
with:
path: tket
- name: Setup tests
run: |
cd tket/pytket/tests
pip install -r requirements.txt
- name: Run tests
run: cd tket/pytket/tests && pytest --ignore=simulator/
test_Linux_aarch64_wheels:
name: Test linux aarch64 wheels
needs: build_Linux_aarch64_wheels
runs-on: ['self-hosted', 'macOS', 'ARM64']
strategy:
matrix:
python3-version: ['9', '10', '11']
steps:
- uses: actions/checkout@v3
with:
path: tket
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: Linux_aarch64_3.${{ matrix.python3-version }}_wheel
path: wheelhouse/
- name: Set up container
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_aarch64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run tests
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker start linux_build
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" linux_build /bin/bash -c "/tket/.github/workflows/linuxtestwheel"
- name: Remove container
if: always()
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker rm --force -v linux_build
- name: Remove directory
if: always()
run: rm -rf wheelhouse
test_macos_wheels:
name: Test macos wheels
needs: build_macos_wheels
strategy:
matrix:
os: ['macos-11', 'macos-12']
python-version: ['3.9', '3.10', '3.11']
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: MacOS_${{ matrix.python-version }}_wheel
path: wheelhouse/
- uses: actions/checkout@v3
with:
path: tket
- name: Install wheel
run: |
pip install $GITHUB_WORKSPACE/wheelhouse/pytket-*.whl
- name: Run tests
run: |
cd tket/pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
test_macos_M1_wheels:
name: Test macos (M1) wheels
needs: build_macos_M1_wheels
runs-on: ['self-hosted', 'macOS', 'ARM64']
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
path: tket
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: MacOS_M1_${{ matrix.python-version }}_wheel
path: wheelhouse/
- name: Install wheel and run tests
run: |
eval "$(pyenv init -)"
pyenv shell tket-${{ matrix.python-version }}
PKG_CONFIG_PATH="$(brew --prefix openblas)"/lib/pkgconfig pip install -U scipy
pip uninstall -y pytket
pip install $GITHUB_WORKSPACE/wheelhouse/pytket-*.whl
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Remove directory
if: always()
run: rm -rf wheelhouse
test_Windows_wheels:
name: Test Windows wheels
needs: build_Windows_wheels
runs-on: windows-2022
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: Windows_${{ matrix.python-version }}_wheel
path: wheelhouse/
- name: Install wheel
shell: bash
run: for i in wheelhouse/pytket-*.whl ; do pip install $i ; done
- uses: actions/checkout@v3
with:
path: tket
- name: Run tests
run: |
pip install pytest hypothesis
cd tket/pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
publish_to_pypi:
name: Publish to pypi
if: github.event_name == 'release'
needs: [test_linux_wheels, test_linux_aarch64_wheels, test_macos_wheels, test_macos_M1_wheels, test_Windows_wheels]
runs-on: ubuntu-22.04
steps:
- name: Download all wheels
uses: actions/download-artifact@v3
with:
path: wheelhouse
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_API_TOKEN }}
verbose: true
build_docs:
name: Build docs
needs: publish_to_pypi
if: github.event_name == 'release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: Linux_3.10_wheel
path: wheelhouse/
- name: Install pip, wheel
run: pip install -U pip wheel
- name: Install pytket
run: for w in `find wheelhouse/ -type f -name "*-cp310-cp310-*.whl"` ; do pip install $w ; done
- name: Install docs dependencies
run: pip install -r pytket/docs/requirements.txt
- name: Build docs
timeout-minutes: 20
run: ./.github/workflows/build-docs
- name: Upload artefact
uses: actions/upload-artifact@v3
with:
name: pytket_docs
path: pytket/docs/build/html/
publish_docs:
name: Publish docs
needs: build_docs
concurrency: gh_pages
if: github.event_name == 'release' && github.event.release.prerelease != true
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
- name: Download artefact
uses: actions/download-artifact@v3
with:
name: pytket_docs
path: api/
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "«$GITHUB_WORKFLOW» github action"
- name: Remove old docs
run: git rm -r docs/pytket/api
- name: Add generated docs to repository
run: |
mkdir -p docs/pytket/
mv api/ docs/pytket/
git add -f docs/pytket/api/
git commit --allow-empty -m "Add generated pytket documentation."
- name: Publish docs
run: git push origin gh-pages:gh-pages