Skip to content

Commit

Permalink
ci: Check coverage with codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Oct 31, 2023
1 parent 3007f82 commit f11a288
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
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 --workspace
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/coverage1.xml,pyrs/coverage2.xml,!pyrs/cache
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

0 comments on commit f11a288

Please sign in to comment.