-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from CQCL/release/0.16.0
Release/0.16.0
- Loading branch information
Showing
331 changed files
with
1,664 additions
and
1,052 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ jobs: | |
if: github.event_name == 'pull_request' | ||
run: | | ||
sudo apt install -y doxygen graphviz | ||
cd bubble && doxygen | ||
cd tket && doxygen | ||
- name: Install conan | ||
id: conan | ||
run: | | ||
|
@@ -131,15 +131,33 @@ jobs: | |
env: | ||
PYTKET_SKIP_REGISTRATION: "true" | ||
steps: | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: '12.5' | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Check C++ code formatting | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
brew install clang-format | ||
brew update | ||
brew install clang-format@13 | ||
git ls-files "*.cpp" "*.hpp" | xargs clang-format -style=file --dry-run --Werror | ||
- name: Get current time | ||
uses: srfrnk/[email protected] | ||
id: current_time | ||
with: | ||
format: YYYYMMDDHHmmss | ||
- name: Cache ccache data | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/Library/Caches/ccache | ||
key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} | ||
restore-keys: | | ||
${{ runner.os }}-tket-ccache- | ||
- name: Install ninja and ccache | ||
run: brew install ninja ccache | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
|
@@ -287,8 +305,8 @@ jobs: | |
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- name: Hash bubble source | ||
id: hash_bubble_source | ||
- name: Hash tket source | ||
id: hash_tket_source | ||
run: | | ||
Function Get-FolderHash | ||
{ | ||
|
@@ -304,8 +322,8 @@ jobs: | |
$ret = [string]::Join("",$($hasher.ComputeHash($allBytes.ToArray()) | %{"{0:x2}" -f $_})) | ||
return $ret | ||
} | ||
$bubble_hash = Get-FolderHash bubble | ||
echo "::set-output name=bubble_hash::${bubble_hash}" | ||
$tket_hash = Get-FolderHash tket | ||
echo "::set-output name=tket_hash::${tket_hash}" | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Install conan | ||
run: | | ||
|
@@ -314,14 +332,14 @@ jobs: | |
conan config set general.revisions_enabled=1 | ||
$conan_cmd = (gcm conan).Path | ||
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV | ||
- name: Cache bubble build | ||
id: cache-bubble | ||
- name: Cache tket build | ||
id: cache-tket | ||
uses: actions/cache@v2 | ||
with: | ||
path: C:\Users\runneradmin\.conan\data\tket | ||
key: ${{ runner.os }}-tket-bubble-${{ steps.hash_bubble_source.outputs.bubble_hash }}-11 | ||
key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-11 | ||
- name: Build tket | ||
if: steps.cache-bubble.outputs.cache-hit != 'true' | ||
if: steps.cache-tket.outputs.cache-hit != 'true' | ||
run: conan create --profile=tket recipes/tket | ||
- name: Build and run tket tests | ||
run: conan create --profile=tket recipes/tket-tests | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2021 Cambridge Quantum Computing | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Usage: | ||
# | ||
# compare-coverage <file> <file1> | ||
# | ||
# where each file contains a couple of lines of text such as: | ||
# | ||
# lines: 87.5% (17090 out of 19537) | ||
# branches: 46.4% (23147 out of 49885) | ||
# | ||
# Returns status 0 if `file1` is at least as good as `file` on both scores, otherwise | ||
# returns status 1. | ||
|
||
import sys | ||
|
||
|
||
def extract_num_from_percent(word): | ||
assert word[-1] == "%" | ||
return float(word[:-1]) | ||
|
||
|
||
def get_percentages(summary): | ||
words = summary.split() | ||
assert words[0] == "lines:" | ||
assert words[6] == "branches:" | ||
return extract_num_from_percent(words[1]), extract_num_from_percent(words[7]) | ||
|
||
|
||
def compare(summary, summary1): | ||
print("Comparing coverage:") | ||
print() | ||
print("Old:") | ||
print(summary) | ||
print("New:") | ||
print(summary1) | ||
|
||
lpercent, bpercent = get_percentages(summary) | ||
lpercent1, bpercent1 = get_percentages(summary1) | ||
|
||
if lpercent1 < lpercent or bpercent1 < bpercent: | ||
print("Percentage line or branch coverage has decreased.") | ||
exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
file, file1 = sys.argv[1:3] | ||
with open(file, "r") as f: | ||
summary = f.read() | ||
with open(file1) as f: | ||
summary1 = f.read() | ||
compare(summary, summary1) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
name: Deploy bubble coverage report | ||
name: Analyse tket C++ test coverage | ||
|
||
on: | ||
schedule: | ||
# 03:00 every Saturday morning | ||
- cron: '0 4 * * 6' | ||
pull_request: | ||
branches: | ||
- develop | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
|
||
linux: | ||
changes: | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
tket: ${{ steps.filter.outputs.tket }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
base: ${{ github.ref }} | ||
filters: | | ||
tket: | ||
- 'tket/**' | ||
generate_coverage: | ||
name: Generate coverage report | ||
needs: changes | ||
if: needs.changes.outputs.tket == 'true' | ||
runs-on: ubuntu-20.04 | ||
env: | ||
CC: gcc-10 | ||
|
@@ -46,13 +65,13 @@ jobs: | |
- name: Build tket | ||
run: | | ||
${CONAN_CMD} install recipes/tket --install-folder=build/tket --profile=tket -o tket:profile_coverage=True | ||
${CONAN_CMD} build recipes/tket --configure --build-folder=build/tket --source-folder=bubble/src | ||
${CONAN_CMD} build recipes/tket --configure --build-folder=build/tket --source-folder=tket/src | ||
${CONAN_CMD} build recipes/tket --build --build-folder=build/tket | ||
${CONAN_CMD} export-pkg recipes/tket -f --build-folder=build/tket --source-folder=bubble/src | ||
${CONAN_CMD} export-pkg recipes/tket -f --build-folder=build/tket --source-folder=tket/src | ||
- name: Build tket tests | ||
run: | | ||
${CONAN_CMD} install recipes/tket-tests --install-folder=build/tket-tests --profile=tket -o tket-tests:with_coverage=True | ||
${CONAN_CMD} build recipes/tket-tests --configure --build-folder=build/tket-tests --source-folder=bubble/tests | ||
${CONAN_CMD} build recipes/tket-tests --configure --build-folder=build/tket-tests --source-folder=tket/tests | ||
${CONAN_CMD} build recipes/tket-tests --build --build-folder=build/tket-tests | ||
- name: Install runtime test requirements | ||
run: | | ||
|
@@ -61,23 +80,60 @@ jobs: | |
wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex | ||
- name: Run tket tests | ||
run: ./build/tket-tests/bin/test_tket | ||
- name: Install gcovr | ||
run: sudo apt-get install gcovr | ||
- name: Build coverage report | ||
run: | | ||
mkdir test-coverage | ||
gcovr --print-summary --html --html-details -r ./tket/src/ --object-directory ${PWD}/build/tket/CMakeFiles/tket.dir -o test-coverage/index.html > test-coverage/summary.txt | ||
- name: Upload artefact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test_coverage | ||
path: test-coverage/ | ||
|
||
publish_coverage: | ||
name: Publish coverage | ||
needs: generate_coverage | ||
concurrency: gh_pages | ||
if: github.event_name == 'push' && needs.changes.outputs.tket == 'true' | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
- name: Download artefact | ||
uses: actions/download-artifact@v2 | ||
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: Check out gh-pages branch | ||
run: git checkout gh-pages | ||
- name: Remove old report | ||
run: git rm -r --ignore-unmatch bubble/test-coverage | ||
- name: Install gcovr | ||
run: sudo apt-get install gcovr | ||
- name: Build coverage report | ||
run: | | ||
mkdir bubble/test-coverage | ||
gcovr --html --html-details -r ./bubble/src/ --object-directory `pwd`/build/tket/CMakeFiles/tket.dir -o bubble/test-coverage/index.html | ||
run: git rm -r docs/tket/test-coverage | ||
- name: Add report to repository | ||
run: | | ||
git add -f bubble/test-coverage | ||
mv test-coverage/ docs/tket/ | ||
git add -f docs/tket/test-coverage | ||
git commit --allow-empty -m "Add generated coverage report." | ||
- name: Publish report | ||
run: git push origin gh-pages:gh-pages | ||
|
||
check_coverage: | ||
name: Check coverage | ||
needs: generate_coverage | ||
if: github.event_name == 'pull_request' && needs.changes.outputs.tket == 'true' | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download artefact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: test_coverage | ||
path: test-coverage/ | ||
- name: Compare with latest report from develop | ||
run: | | ||
wget https://cqcl.github.io/tket/tket/test-coverage/summary.txt | ||
./.github/workflows/compare-coverage summary.txt test-coverage/summary.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,52 @@ | ||
name: Deploy bubble documentation | ||
name: Deploy tket C++ documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
paths: | ||
- 'bubble/src/**' | ||
- 'tket/src/**' | ||
|
||
jobs: | ||
bubble_docs: | ||
|
||
build_docs: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
|
||
- name: Install Doxygen | ||
run: sudo apt update && sudo apt install -y doxygen graphviz | ||
|
||
- name: Build Doxygen docs | ||
run: cd tket && doxygen | ||
- name: Upload artefact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tket_docs | ||
path: tket/doc/html/ | ||
publish_docs: | ||
needs: build_docs | ||
concurrency: gh_pages | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
- name: Download artefact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: tket_docs | ||
path: api/ | ||
- name: Configure git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "«$GITHUB_WORKFLOW» github action" | ||
- name: Check out gh-pages branch | ||
run: git checkout gh-pages | ||
|
||
- name: Remove old docs | ||
run: git rm -r --ignore-unmatch bubble/doc/html | ||
|
||
- name: Build Doxygen docs | ||
run: cd bubble && doxygen | ||
|
||
run: git rm -r docs/tket/api | ||
- name: Add generated docs to repository | ||
run: | | ||
git add -f bubble/doc/html | ||
git commit --allow-empty -m "Add generated bubble documentation." | ||
mv api/ docs/tket/ | ||
git add -f docs/tket/api | ||
git commit --allow-empty -m "Add generated tket C++ documentation." | ||
- name: Publish docs | ||
run: git push origin gh-pages:gh-pages |
Oops, something went wrong.