Skip to content

Add BasePass.get_pre_conditions and BasePass.get_post_conditions #5299

Add BasePass.get_pre_conditions and BasePass.get_post_conditions

Add BasePass.get_pre_conditions and BasePass.get_post_conditions #5299

Workflow file for this run

name: Analyse tket C++ test coverage
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
# 03:00 every Saturday morning
- cron: '0 3 * * 6'
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04
outputs:
tket: ${{ steps.filter.outputs.tket }}
steps:
- uses: actions/checkout@v4
- uses: dorny/[email protected]
id: filter
with:
base: ${{ github.ref }}
filters: |
tket:
- 'tket/**'
- '.github/workflows/coverage.yml'
generate_coverage:
name: Generate coverage report
needs: changes
if: needs.changes.outputs.tket == 'true' || github.event_name == 'schedule'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Select Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/[email protected]
- 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/[email protected]
with:
key: tket-coverage-build
- name: further ccache config
run: |
ccache --set-config compiler_check=content
ccache --set-config hash_dir=false # better performance for debug builds
ccache -p
- name: Build tket
run: |
conan build tket --user=tket --channel=stable -s build_type=Debug --build=missing -o boost/*:header_only=True -o tket/*:profile_coverage=True -o with_test=True -o test-tket/*:with_coverage=True -of build/tket
conan export-pkg tket --user=tket --channel=stable -s build_type=Debug -o boost/*:header_only=True -o tket/*:profile_coverage=True -o with_test=True -of build/tket -tf ""
- name: Install runtime test requirements
if: github.event_name == 'schedule'
run: |
sudo apt-get update
sudo apt-get 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: Run full tket tests
if: github.event_name == 'schedule'
working-directory: ./build/tket-tests/build/Debug
run: ./test-tket "[long],~[long]"
- name: Install gcovr
run: pip install gcovr~=6.0
- name: Build coverage report
run: |
mkdir test-coverage
gcovr --print-summary --html --html-details -r ./tket --exclude-lines-by-pattern '.*\bTKET_ASSERT\(.*\);' --object-directory ${PWD}/build/tket/build/Debug/CMakeFiles/tket.dir/src -o test-coverage/index.html --decisions > test-coverage/summary.txt
cat test-coverage/summary.txt
- name: Upload artefact
uses: actions/upload-artifact@v4
with:
name: test_coverage
path: test-coverage/
check_coverage:
name: Check coverage
needs: generate_coverage
if: ((github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && needs.changes.outputs.tket == 'true') || github.event_name == 'schedule'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Download artefact
uses: actions/download-artifact@v4
with:
name: test_coverage
path: test-coverage/
- name: Compare with latest report from main (short tests)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: |
wget https://cqcl.github.io/tket/tket/test-coverage-short/summary.txt
./.github/workflows/compare-coverage summary.txt test-coverage/summary.txt
- name: Compare with latest report from main (full suite)
if: github.event_name == 'schedule'
run: |
wget https://cqcl.github.io/tket/tket/test-coverage/summary.txt
./.github/workflows/compare-coverage summary.txt test-coverage/summary.txt
publish_coverage_short:
name: Publish coverage (short tests)
needs: generate_coverage
concurrency: gh_pages
if: github.event_name == 'push' && needs.changes.outputs.tket == 'true'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- name: Download artefact
uses: actions/download-artifact@v4
with:
name: test_coverage
path: test-coverage/
- 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/tket/test-coverage-short
- name: Add report to repository
run: |
mv test-coverage docs/tket/test-coverage-short
git add -f docs/tket/test-coverage-short
git commit --allow-empty -m "Add generated coverage report (short tests)."
- name: Publish report
run: git push origin gh-pages:gh-pages
publish_coverage_full:
name: Publish coverage (full suite)
needs: check_coverage
concurrency: gh_pages
if: github.event_name == 'schedule'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- name: Download artefact
uses: actions/download-artifact@v4
with:
name: test_coverage
path: test-coverage/
- 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/tket/test-coverage
- name: Add report to repository
run: |
mv test-coverage docs/tket/test-coverage
git add -f docs/tket/test-coverage
git commit --allow-empty -m "Add generated coverage report (full suite)."
- name: Publish report
run: git push origin gh-pages:gh-pages