-
Notifications
You must be signed in to change notification settings - Fork 47
660 lines (644 loc) · 27.3 KB
/
build_and_test.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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
name: Build and test
on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
schedule:
# 03:00 every Saturday morning
- cron: '0 3 * * 6'
workflow_dispatch: {}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check_changes:
name: Check tket library version
runs-on: ubuntu-22.04
outputs:
tket_changed: ${{ steps.filter.outputs.tket }}
doxyfile_changed: ${{ steps.filter.outputs.doxyfile }}
pytket_changed: ${{ steps.filter.outputs.pytket }}
tket_ver: ${{ steps.tket_ver.outputs.tket_ver }}
tket_package_exists: ${{ steps.tket_package_exists.outputs.tket_package_exists }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: dorny/[email protected]
id: filter
with:
base: ${{ github.ref }}
filters: |
tket:
- '{tket/src/**,tket/include/**,tket/conanfile.py,tket/CMakeLists.txt,tket/cmake/**,tket/test/**,tket/proptest/**}'
doxyfile:
- '{tket/Doxyfile}'
pytket:
- 'pytket/**'
- name: Install conan
uses: turtlebrowser/[email protected]
- name: parse version from conanfile
id: tket_ver
run: |
tket_ver=$(conan inspect tket/conanfile.py | grep "^version: " | awk '{print $2}')
echo "tket_ver=${tket_ver}" >> $GITHUB_OUTPUT
- name: See if version exists on remote
id: test_package_exists
run: |
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
tket_package_exists=`conan search -r tket-libs "tket/${{ steps.tket_ver.outputs.tket_ver }}@tket/stable" | grep "not found" > /dev/null 2>&1 && echo false || echo true`
echo "tket_package_exists=${tket_package_exists}" >> $GITHUB_OUTPUT
- name: Check tket version bump
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'develop' && steps.filter.outputs.tket == 'true' && steps.test_package_exists.outputs.tket_package_exists == 'true'
run: exit 1
check_docs_tket:
name: Check documentation build
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true' || needs.check_changes.outputs.doxyfile_changed == 'true'
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@v3
- name: Check doxygen
run: |
sudo apt install -y doxygen graphviz
cd tket && doxygen
check_format_tket:
name: Check C++ code formatting
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true'
runs-on: 'macos-12'
steps:
- uses: actions/checkout@v3
- name: Check C++ code formatting
run: |
brew update
brew install clang-format@16
git ls-files "*.cpp" "*.hpp" | xargs clang-format -style=file --dry-run --Werror
build_test_tket:
name: Build and test (tket)
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true'
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: apt update
if: matrix.os == 'ubuntu-22.04'
run: sudo apt update
- name: Select Python 3.10
# otherwise turtlebrowser/[email protected] fails on macos-12
uses: actions/setup-python@v4
with:
python-version: '3.10'
- 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: Install runtime test requirements
if: matrix.os == 'ubuntu-22.04' && github.event_name == 'schedule'
run: |
sudo apt install texlive texlive-latex-extra latexmk
mkdir -p ~/texmf/tex/latex
wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: tket-static-${{ matrix.os }}
- name: further ccache config
run: |
ccache --set-config base_dir=${HOME}
ccache --set-config compiler_check=content
ccache --set-config namespace=WITH_TESTS
ccache -p
- name: Build tket
run: conan create tket -s build_type=Release --user=tket --channel=stable -o boost/*:header_only=True -o with_all_tests=True
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
ccache --set-config namespace=WITHOUT_TESTS
conan create tket --user=tket --channel=stable -o boost/*:header_only=True
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
build_test_tket_windows:
name: Build and test (tket)
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true'
strategy:
matrix:
os: ['windows-2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install conan
uses: turtlebrowser/[email protected]
with:
version: '2.0.9'
- name: Set up conan
id: conan-setup
run: |
conan profile detect
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: normalize line endings in conanfile and src directory
# This is necessary to ensure consistent revisions across platforms.
# Conan's revision hash is composed of hashes of all the exported files,
# so we must normalize the line endings in these.
run: |
$tket_files = Get-ChildItem "tket" -File -Recurse
foreach ($f in $tket_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: ninja ccache setup
# This is what hendrikmuhs/ccache-action does, but for windows (theirs is buggy on windows)
id: ninja-ccache-setup
run: |
choco upgrade ccache ninja
$ccache_dir = ccache --get-config cache_dir
echo ccache_dir=$ccache_dir >> $env:GITHUB_OUTPUT
ccache --set-config=max_size='500M'
ccache --set-config=compression=true
ccache --set-config compiler_check=content
ccache --set-config namespace=WITH_TESTS
ccache -p
- name: Get current time
uses: josStorer/[email protected]
id: current_time
with:
format: YYYYMMDDHHmmss
- name: ccache windows
uses: actions/cache@v3
with:
path: ${{ steps.ninja-ccache-setup.outputs.ccache_dir }}
key: tket-static-${{ matrix.os }}-${{ steps.current_time.outputs.formattedTime }}
restore-keys: |
tket-static-${{ matrix.os }}-
- name: Build tket
# On windows use install + build so build directory is consistent across runs (i.e. don't build from conan cache)
# Necessary because setting ccache base_dir doesn't currently work on windows
run: |
conan install tket --user=tket --channel=stable -o boost/*:header_only=True -o with_all_tests=True -c tools.cmake.cmaketoolchain:generator=Ninja
conan build tket --user=tket --channel=stable -o boost/*:header_only=True -o with_all_tests=True -c tools.cmake.cmaketoolchain:generator=Ninja
conan export-pkg tket --user=tket --channel=stable -o boost/*:header_only=True -o with_all_tests=True -c tools.cmake.cmaketoolchain:generator=Ninja
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
ccache --set-config namespace=WITHOUT_TESTS
conan install tket --user=tket --channel=stable -o boost/*:header_only=True
conan build tket --user=tket --channel=stable -o boost/*:header_only=True
conan export-pkg tket --user=tket --channel=stable -o boost/*:header_only=True
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
- name: ccache stats
run: |
ccache -s #show stats
ccache -z #show stats
build_test_tket_macos_arm64:
name: Build and test tket (macos-arm64)
runs-on: ['self-hosted', 'macOS', 'ARM64']
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true' && github.repository == 'CQCL/tket'
steps:
- uses: actions/checkout@v3
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Set up conan
run: |
conan profile detect --force
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --force --index 0
conan cache clean
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: tket-static-macos-arm64
- name: further ccache config
run: |
ccache --set-config base_dir=${HOME}
ccache --set-config compiler_check=content
ccache --set-config namespace=WITH_TESTS
ccache -p
- name: Build tket
run: conan create tket --user=tket --channel=test_build -o boost/*:header_only=True -o with_all_tests=True
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
ccache --set-config namespace=WITHOUT_TESTS
conan create tket --user=tket --channel=stable -o boost/*:header_only=True
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
build_test_tket_not_required:
name: Build and test (tket)
needs: check_changes
if: needs.check_changes.outputs.tket_changed != 'true'
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- run: echo "no changes to tket"
build_test_tket_macos_arm64_not_required:
name: Build and test (tket)
runs-on: ['self-hosted', 'macOS', 'ARM64']
needs: check_changes
if: needs.check_changes.outputs.tket_changed != 'true'
steps:
- run: echo "no changes to tket"
build_test_pytket_ubuntu:
name: Build and test pytket (ubuntu)
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true' || needs.check_changes.outputs.pytket_changed == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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: ccache
uses: hendrikmuhs/[email protected]
with:
key: tket-dynamic-ubuntu-22.04
- name: further ccache config
run: |
ccache --set-config base_dir=${HOME}
ccache --set-config compiler_check=content
ccache -p
- name: Build tket
if: needs.check_changes.outputs.tket_changed == 'true'
run: conan create tket --user tket --channel stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
- name: Install tket
if: needs.check_changes.outputs.tket_changed != 'true'
run: conan install --requires tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True
- name: check that version is consistent
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: ./.github/workflows/check-tket-reqs ${{ needs.check_changes.outputs.tket_ver }}
- name: Install pytket requirements
run: |
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
- name: Set up Python (pull request)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Python (push)
if: github.event_name == 'push'
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Python (schedule)
if: github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build pytket
run: |
cd pytket
pip install -e .[ZX] -v
- name: Run doctests
run: |
cd pytket
pip install pytest
pytest --doctest-modules pytket
- name: Test pytket with coverage
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/ --hypothesis-seed=1 --cov=../pytket --cov-branch --cov-report=html --cov-report=xml:htmlcov/cov.xml
- name: Test pytket
if: github.event_name != 'pull_request' || github.event_name == 'workflow_dispatch'
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Test building docs
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
timeout-minutes: 20
run: |
pip install -r pytket/docs/requirements.txt
./.github/workflows/build-docs
- name: Upload artefact
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v3
with:
name: pytket_docs
path: pytket/docs/build/html/
- name: Upload pytket coverage artefact
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v3
with:
name: pytket_test_coverage
path: pytket/tests/htmlcov
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' && needs.check_changes.outputs.tket_changed == 'true'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
build_test_pytket_macos:
name: Build and test pytket (macos)
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true' || needs.check_changes.outputs.pytket_changed == 'true'
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Select Python 3.10
# otherwise turtlebrowser/[email protected] fails on macos-12
uses: actions/setup-python@v4
with:
python-version: '3.10'
- 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: ccache
uses: hendrikmuhs/[email protected]
with:
key: tket-dynamic-macos-12
- name: further ccache config
run: |
ccache --set-config base_dir=${HOME}
ccache --set-config compiler_check=content
ccache -p
- name: Build tket
if: needs.check_changes.outputs.tket_changed == 'true'
run: conan create tket --user tket --channel stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
- name: Install tket
if: needs.check_changes.outputs.tket_changed != 'true'
run: conan install --requires tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True
- name: check that version is consistent
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: ./.github/workflows/check-tket-reqs ${{ needs.check_changes.outputs.tket_ver }}
- name: Install pytket requirements
run: |
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
- name: Set up Python (pull request)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Python (push)
if: github.event_name == 'push'
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Python (schedule)
if: github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build pytket
run: |
cd pytket
pip install -e .[ZX] -v
- name: Run doctests
run: |
cd pytket
pip install pytest
pytest --doctest-modules pytket
- name: Test pytket
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Check type stubs are up-to-date and run mypy
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: |
pip install -U mypy
cd pytket
./stub_generation/regenerate_stubs
git diff --quiet pytket/_tket && echo "Stubs are up-to-date" || exit 1 # fail if stubs change after regeneration
mypy --config-file=mypy.ini --no-incremental -p pytket -p tests
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' && needs.check_changes.outputs.tket_changed == 'true'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
build_test_pytket_windows:
name: Build and test pytket (windows)
# I could not get ccache working for this build
# Building tket as a dynamic library currently fails with the Ninja and Makefiles Generators and ccache is set up is more difficult with the Visual Studio generator
# I tried to get ccache working with the Visual Studio generator using the suggestions here: https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake
# I was able to get ccache to wrap the compiler invocations, but all files are reported as uncacheable, due to "No input file"
# See https://ccache.dev/manual/4.8.2.html#_cache_statistics for more info on what that means. I myself haven't fully understood.
# Giving up for now
needs: check_changes
if: needs.check_changes.outputs.tket_changed == 'true' || needs.check_changes.outputs.pytket_changed == 'true'
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- 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: normalize line endings in conanfile and src directory
# This is necessary to ensure consistent revisions across platforms.
# Conan's revision hash is composed of hashes of all the exported files,
# so we must normalize the line endings in these.
run: |
$tket_files = Get-ChildItem "tket" -File -Recurse
foreach ($f in $tket_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: Build tket
if: needs.check_changes.outputs.tket_changed == 'true'
run: |
conan create tket --user tket --channel stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf `"`"
- name: Install tket
if: needs.check_changes.outputs.tket_changed != 'true'
run: conan install --requires tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True
- name: check that version is consistent
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: ./.github/workflows/check-tket-reqs ${{ needs.check_changes.outputs.tket_ver }}
- name: Install pytket requirements
run: |
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
- name: Set up Python (3.9)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Python (3.10)
if: github.event_name == 'push'
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Python (3.11)
if: github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build pytket
run: |
cd pytket
pip install -e .[ZX] -v
- name: Run doctests
run: |
cd pytket
pip install pytest
pytest --doctest-modules pytket
- name: Test pytket
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' && needs.check_changes.outputs.tket_changed == 'true'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
build_test_pytket_macos_arm64:
name: Build and test pytket (macos-arm64)
runs-on: ['self-hosted', 'macOS', 'ARM64']
needs: check_changes
if: (needs.check_changes.outputs.tket_changed == 'true' || needs.check_changes.outputs.pytket_changed == 'true') && github.repository == 'CQCL/tket'
steps:
- uses: actions/checkout@v3
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Set up conan
run: |
conan profile detect --force
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --force --index 0
- name: Remove tket package from cache
run: conan remove -c 'tket/*'
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: tket-dynamic-macos-arm64
- name: further ccache config
run: |
ccache --set-config base_dir=${HOME}
ccache --set-config compiler_check=content
ccache -p
- name: Build tket
if: needs.check_changes.outputs.tket_changed == 'true'
run: conan create tket --user tket --channel stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
- name: check that version is consistent
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: ./.github/workflows/check-tket-reqs ${{ needs.check_changes.outputs.tket_ver }}
- name: Uninstall conan
run: pip3 uninstall -y conan
- name: Build and test pytket (3.9)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: |
eval "$(pyenv init -)"
pyenv shell tket-3.9
PKG_CONFIG_PATH="$(brew --prefix openblas)"/lib/pkgconfig pip install -U scipy
pip install -U conan
conan remove -c "pybind11/*"
conan remove -c "pytket/*"
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
pip uninstall -y pytket
pip install -e .[ZX] -v
pytest --doctest-modules pytket
cd tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Build and test pytket (3.10)
if: github.event_name == 'push'
run: |
eval "$(pyenv init -)"
pyenv shell tket-3.10
PKG_CONFIG_PATH="$(brew --prefix openblas)"/lib/pkgconfig pip install -U scipy
pip install -U conan
conan remove -c "pybind11/*"
conan remove -c "pytket/*"
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
pip uninstall -y pytket
pip install -e .[ZX] -v
pytest --doctest-modules pytket
cd tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Build and test pytket (3.11)
if: github.event_name == 'schedule'
run: |
eval "$(pyenv init -)"
pyenv shell tket-3.11
PKG_CONFIG_PATH="$(brew --prefix openblas)"/lib/pkgconfig pip install -U scipy
pip install -U conan
conan remove -c "pybind11/*"
conan remove -c "pytket/*"
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
pip uninstall -y pytket
pip install -e .[ZX] -v
pytest --doctest-modules pytket
cd tests
pip install -r requirements.txt
pytest --ignore=simulator/
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Upload package
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' && needs.check_changes.outputs.tket_changed == 'true'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload tket/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
conan remote logout tket-libs
publish_pytket_coverage:
name: Publish pytket coverage
needs: build_test_pytket_ubuntu
concurrency: gh_pages
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
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_test_coverage
path: htmlcov/
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "«$GITHUB_WORKFLOW» github action"
- name: Remove old report
run: git rm -r docs/pytket/test-coverage
- name: Add report to repository
run: |
mv htmlcov docs/pytket/test-coverage
git add -f docs/pytket/test-coverage
git commit --allow-empty -m "Add generated pytket coverage report."
- name: Publish report
run: git push origin gh-pages:gh-pages
check_pytket_coverage:
name: Check pytket line and branch coverage
needs: build_test_pytket_ubuntu
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Download artefact
uses: actions/download-artifact@v3
with:
name: pytket_test_coverage
path: pytket-test-coverage/
- name: Compare with latest report from develop
run: |
wget https://cqcl.github.io/tket/pytket/test-coverage/cov.xml -O oldcov.xml
./.github/workflows/compare-pytket-coverage oldcov.xml pytket-test-coverage/cov.xml