Bugfix/slow get statevector (#952) #3240
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Analyse tket C++ test coverage | |
on: | |
pull_request: | |
branches: | |
- develop | |
push: | |
branches: | |
- develop | |
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-22.04 | |
outputs: | |
tket: ${{ steps.filter.outputs.tket }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2.11.1 | |
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-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install conan | |
uses: turtlebrowser/get-conan@v1.2 | |
- name: create profile | |
run: conan profile detect | |
- name: add remote | |
run: 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-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 install 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 -of build/tket | |
conan build tket --user=tket --channel=stable -s build_type=Debug -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@v3 | |
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-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artefact | |
uses: actions/download-artifact@v3 | |
with: | |
name: test_coverage | |
path: test-coverage/ | |
- name: Compare with latest report from develop (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 develop (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-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- name: Download artefact | |
uses: actions/download-artifact@v3 | |
with: | |
name: test_coverage | |
path: test-coverage/ | |
- 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/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-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- name: Download artefact | |
uses: actions/download-artifact@v3 | |
with: | |
name: test_coverage | |
path: test-coverage/ | |
- 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/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 |