Skip to content

fix wasm issue

fix wasm issue #7571

Workflow file for this run

name: Build and test
on:
pull_request:
branches:
- main
push:
branches:
- main
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-24.04
outputs:
tket_or_workflow_changed: ${{ steps.filter.outputs.tket_or_workflow }}
tket_or_c_api_changed: ${{ steps.filter.outputs.tket_or_c_api }}
tket_changed: ${{ steps.filter.outputs.tket }}
doxyfile_or_workflow_changed: ${{ steps.filter.outputs.doxyfile_or_workflow }}
pytket_or_workflow_changed: ${{ steps.filter.outputs.pytket_or_workflow }}
tket_ver: ${{ steps.tket_ver.outputs.tket_ver }}
steps:
- uses: actions/checkout@v6
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- uses: dorny/paths-filter@v4.0.1
id: filter
with:
base: ${{ github.ref }}
filters: |
tket:
- '{tket/src/**,tket/include/**,tket/conanfile.py,tket/CMakeLists.txt,tket/cmake/**,tket/test/**,tket/proptest/**,TKET_VERSION}'
tket_or_workflow:
- '{tket/src/**,tket/include/**,tket/conanfile.py,tket/CMakeLists.txt,tket/cmake/**,tket/test/**,tket/proptest/**,TKET_VERSION}'
- '.github/workflows/build_and_test.yml'
tket_or_c_api:
- '{tket/src/**,tket/include/**,tket/conanfile.py,tket/CMakeLists.txt,tket/cmake/**,tket/test/**,tket/proptest/**,TKET_VERSION}'
- '{tket-c-api/src/**,tket-c-api/include/**,tket-c-api/conanfile.py,tket-c-api/CMakeLists.txt}'
doxyfile_or_workflow:
- '{tket/Doxyfile}'
- '.github/workflows/build_and_test.yml'
pytket_or_workflow:
- 'pytket/**'
- '.github/workflows/build_and_test.yml'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Read version from file
id: tket_ver
run: |
tket_ver=$(cat TKET_VERSION)
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`
tket_c_api_package_exists=`conan search -r tket-libs "tket-c-api/${{ steps.tket_ver.outputs.tket_ver }}@tket/stable" | grep "not found" > /dev/null 2>&1 && echo false || echo true`
# Set tket_package_exists to true if either tket or tket-c-api package exists
if [[ "${tket_package_exists}" == "true" || "${tket_c_api_package_exists}" == "true" ]]; then
echo "tket_package_exists=true" >> $GITHUB_OUTPUT
else
echo "tket_package_exists=false" >> $GITHUB_OUTPUT
fi
- name: Check tket version bump
if: github.event_name == 'pull_request' && steps.filter.outputs.tket_or_c_api == '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_or_workflow_changed == 'true' || needs.check_changes.outputs.doxyfile_or_workflow_changed == 'true'
runs-on: 'ubuntu-24.04'
steps:
- uses: actions/checkout@v6
- name: Check doxygen
run: |
sudo apt install -y doxygen graphviz
cd tket && doxygen
check_format_tket:
name: Check C++ code formatting
runs-on: 'macos-latest'
steps:
- uses: actions/checkout@v6
- name: Check C++ code formatting
run: |
brew update
brew install clang-format@22
git ls-files "*.cpp" "*.hpp" "*.h" | xargs clang-format -style=file -i
git diff --exit-code
build_test_tket:
name: Build and test (tket)
needs: check_changes
if: needs.check_changes.outputs.tket_or_c_api_changed == 'true'
strategy:
matrix:
os: ['ubuntu-24.04', 'macos-15-intel', 'macos-26']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: apt update
if: matrix.os == 'ubuntu-24.04'
run: sudo apt update
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/${{ matrix.os }}
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
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-24.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/ccache-action@v1.2
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: Build tket-c-api
run: conan create tket-c-api -s build_type=Release --user=tket --channel=stable -o boost/*:header_only=True -o tket/*:with_all_tests=True
- name: Upload packages
if: github.event_name == 'push'
run: |
ccache --set-config namespace=WITHOUT_TESTS
conan create tket --user=tket --channel=stable -o boost/*:header_only=True
conan create tket-c-api --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
conan upload tket-c-api/${{ 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_or_c_api_changed == 'true'
strategy:
matrix:
os: ['windows-2025']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
shell: bash
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/${{ matrix.os }}
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
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
$tket_files += Get-Item "TKET_VERSION"
$tket_c_api_files = Get-ChildItem "tket-c-api" -File -Recurse
$tket_files += $tket_c_api_files
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/get-current-time@v2.1.2
id: current_time
with:
format: YYYYMMDDHHmmss
- name: ccache windows
uses: actions/cache@v5
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 build + export-pkg 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 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: Build tket-c-api
# On windows use build + export-pkg 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 build tket-c-api --user=tket --channel=stable -o boost/*:header_only=True -o tket/*:with_all_tests=True -c tools.cmake.cmaketoolchain:generator=Ninja
conan export-pkg tket-c-api --user=tket --channel=stable -o boost/*:header_only=True -o tket/*:with_all_tests=True -c tools.cmake.cmaketoolchain:generator=Ninja
- name: Upload packages
if: github.event_name == 'push'
run: |
ccache --set-config namespace=WITHOUT_TESTS
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 build tket-c-api --user=tket --channel=stable -o boost/*:header_only=True
conan export-pkg tket-c-api --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
conan upload tket-c-api/${{ needs.check_changes.outputs.tket_ver }}@tket/stable -r=tket-libs
- name: ccache stats
run: |
ccache -s #show stats
ccache -z #show stats
build_tket_c_api_manylinux:
name: Build tket-c-api and upload to artifactory
strategy:
matrix:
include:
- os: 'ubuntu-24.04'
container: 'manylinux_2_28_x86_64'
profile: 'linux-x86_64-gcc14'
- os: 'ubuntu-24.04-arm'
container: 'manylinux_2_28_aarch64'
profile: 'linux-armv8-gcc14'
needs: check_changes
if: (needs.check_changes.outputs.tket_or_c_api_changed == 'true') && (github.event_name == 'push')
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
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/${{ matrix.container }}:latest /bin/bash
- name: Copy source
run: docker cp . linux_build:/tket/
- name: Start container
run: docker start linux_build
- name: Build and upload tket-c-api
run: docker exec -e CONAN_PROFILE=${{ matrix.profile }} -e TKET_VERSION=`cat TKET_VERSION` -e JFROG_ARTIFACTORY_TOKEN_3=${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} -e JFROG_ARTIFACTORY_USER_3=${{ secrets.JFROG_ARTIFACTORY_USER_3 }} linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildcapi"
build_test_pytket_ubuntu:
name: Build and test pytket (ubuntu)
needs: check_changes
if: needs.check_changes.outputs.tket_or_workflow_changed == 'true' || needs.check_changes.outputs.pytket_or_workflow_changed == 'true'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/ubuntu-24.04
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: tket-dynamic-ubuntu-24.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: Set up Python (pull request)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Python (push)
if: github.event_name == 'push'
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Python (schedule)
if: github.event_name == 'schedule'
uses: actions/setup-python@v6
with:
python-version: '3.14'
- 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: Upload artifact
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: pytket_docs
path: pytket/docs/build/
- name: Upload pytket coverage artefact
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: pytket_test_coverage
path: pytket/tests/htmlcov
- name: Upload package
if: github.event_name == 'push' && 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_or_workflow_changed == 'true' || needs.check_changes.outputs.pytket_or_workflow_changed == 'true'
strategy:
matrix:
os: ['macos-15-intel', 'macos-26']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/${{ matrix.os }}
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: tket-dynamic-macos
- 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: Set up Python (pull request)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Python (push)
if: github.event_name == 'push'
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Python (schedule)
if: github.event_name == 'schedule'
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Build pytket (with zx)
if: matrix.os == 'macos-26'
run: |
cd pytket
pip install -e .[ZX] -v
- name: Build pytket (without zx)
if: matrix.os == 'macos-15-intel'
run: |
cd pytket
pip install -e . -v
- name: Run doctests
run: |
cd pytket
python -m pip install pytest
python -m pytest --doctest-modules pytket
- name: Test pytket
run: |
cd pytket/tests
python -m pip install -r requirements.txt
python -m pytest --ignore=simulator/
- name: Check type stubs are up-to-date and run mypy
if: matrix.os == 'macos-26' && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
run: |
python -m pip install mypy nanobind==2.12.0
cd pytket
./stub_generation/regenerate_stubs
git diff --exit-code pytket/_tket && echo "Stubs are up-to-date" || exit 1 # fail if stubs change after regeneration
python -m mypy --config-file=mypy.ini --no-incremental -p pytket -p tests
- name: Upload package
if: github.event_name == 'push' && 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)
needs: check_changes
if: needs.check_changes.outputs.tket_or_workflow_changed == 'true' || needs.check_changes.outputs.pytket_or_workflow_changed == 'true'
runs-on: windows-2025
steps:
- uses: actions/checkout@v6
- name: Select Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
shell: bash
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/windows-2025
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
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
$tket_files += Get-Item "TKET_VERSION"
foreach ($f in $tket_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: ccache setup
# This is what hendrikmuhs/ccache-action does, but for windows (theirs is buggy on windows)
id: ccache-setup
run: |
choco upgrade ccache
$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/get-current-time@v2.1.2
id: current_time
with:
format: YYYYMMDDHHmmss
- name: ccache windows
uses: actions/cache@v5
with:
path: ${{ steps.ccache-setup.outputs.ccache_dir }}
key: tket-dynamic-visual-studio-windows-2025-${{ steps.current_time.outputs.formattedTime }}
restore-keys: |
tket-dynamic-visual-studio-windows-2025
- name: get ccache path
id: ccache-path
shell: bash
run: |
ccache --shimgen-noop > ccache-info.txt || true
a=$(cat ccache-info.txt | grep executable)
# strip off the initial " path to executable: "
b=${a:22}
echo "ccache_path=${b}" >> $GITHUB_OUTPUT
- name: Build tket
if: needs.check_changes.outputs.tket_changed == 'true'
run: |
$env:TKET_VSGEN_CCACHE_EXE = '${{ steps.ccache-path.outputs.ccache_path }}'
conan build tket --user tket --channel stable -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True
conan export-pkg 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: Set up Python 3.10
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Python 3.11
if: github.event_name == 'push'
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Python 3.12
if: github.event_name == 'schedule'
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Build pytket
shell: bash
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' && 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
- name: ccache stats
run: |
ccache -s #show stats
ccache -z #show stats
publish_pytket_coverage:
name: Publish pytket coverage
needs: build_test_pytket_ubuntu
concurrency: gh_pages
if: github.event_name == 'push'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
ref: gh-pages
- name: Download artefact
uses: actions/download-artifact@v8
with:
name: pytket_test_coverage
path: htmlcov/
- name: Configure git
run: |
git config --global user.email "tket-bot@cambridgequantum.com"
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-24.04
steps:
- uses: actions/checkout@v6
- name: Download artefact
uses: actions/download-artifact@v8
with:
name: pytket_test_coverage
path: pytket-test-coverage/
- name: Compare with latest report from main
run: |
wget https://quantinuum.github.io/tket/pytket/test-coverage/cov.xml -O oldcov.xml
./.github/workflows/compare-pytket-coverage oldcov.xml pytket-test-coverage/cov.xml
check_all_build_and_test_jobs_successful:
name: All build and test jobs successful (or skipped)
needs:
- check_changes
- check_docs_tket
- check_format_tket
- build_test_tket
- build_test_tket_windows
- publish_pytket_coverage
- build_test_pytket_macos
- build_test_pytket_ubuntu
- build_test_pytket_windows
- publish_pytket_coverage
- check_pytket_coverage
if: always()
runs-on: ubuntu-24.04
steps:
- shell: python
name: Check job results
run: |
results = {
"check_changes": "${{ needs.check_changes.result }}",
"check_docs_tket": "${{ needs.check_docs_tket.result }}",
"check_format_tket": "${{ needs.check_format_tket.result }}",
"build_test_tket": "${{ needs.build_test_tket.result }}",
"build_test_tket_windows": "${{ needs.build_test_tket_windows.result }}",
"publish_pytket_coverage": "${{ needs.publish_pytket_coverage.result }}",
"build_test_pytket_macos": "${{ needs.build_test_pytket_macos.result }}",
"build_test_pytket_ubuntu": "${{ needs.build_test_pytket_ubuntu.result }}",
"build_test_pytket_windows": "${{ needs.build_test_pytket_windows.result }}",
"publish_pytket_coverage": "${{ needs.publish_pytket_coverage.result }}",
"check_pytket_coverage": "${{ needs.check_pytket_coverage.result }}"
}
failed_jobs = [job for job, status in results.items() if status in ("failure", "cancelled")]
if failed_jobs:
print(f"Job(s) failed or cancelled: {', '.join(failed_jobs)}")
raise Exception