Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Check coverage with codecov #205

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 56 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,75 @@ jobs:
name: "python bindings"
steps:
- uses: actions/checkout@v3
- uses: mozilla-actions/sccache-action@v0.0.3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
components: rustfmt, clippy
python-version: '3.11'
cache: 'pip'
- name: Build pyo3 bindings
run: |
pip install -r requirements.txt
cd pyrs
maturin build
pip install ../target/wheels/*.whl
- name: Test pyo3 bindings
run: |
cd pyrs
pytest
coverage:
if: github.event_name != 'merge_group'
needs: [tests, check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests with coverage instrumentation
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov --doctests --all-features
cargo llvm-cov report --codecov --output-path coverage.json
- name: Upload rust coverage to codecov.io
uses: codecov/codecov-action@v3
with:
files: coverage.json
name: rust
token: ${{ secrets.CODECOV_TOKEN }}

py-coverage:
if: github.event_name != 'merge_group'
needs: [py-tests, check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/sccache-action@v0.0.3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Build pyo3 bindings
run: |
pip install -r requirements.txt
pip install pytest-cov
cd pyrs
maturin build
pip install ../target/wheels/*.whl
- name: Test pyo3 bindings
- name: Run python tests with coverage instrumentation
run: |
cd pyrs
pytest
pytest --cov=./ --cov-report=xml
- name: Upload python coverage to codecov.io
uses: codecov/codecov-action@v3
with:
files: pyrs/coverage.xml
name: python
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

[![build_status][]](https://github.com/CQCL-DEV/tket2/actions)
![msrv][]
[![codecov][]](https://codecov.io/gh/CQCL/tket2)

Version 2 of the TKET compiler.

[build_status]: https://github.com/CQCL-DEV/hugr/workflows/Continuous%20integration/badge.svg?branch=main
[msrv]: https://img.shields.io/badge/rust-1.70.0%2B-blue.svg
[codecov]: https://img.shields.io/codecov/c/gh/CQCL/tket2?logo=codecov

## Features

Expand Down