From 906c4e2c2f243274f887003a75eb7740a8144a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= <121866228+aborgna-q@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:20:45 +0100 Subject: [PATCH] ci: add codecov coverage report (#115) --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++++++- README.md | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 940b6ac..494915d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: - main merge_group: types: [checks_requested] + workflow_dispatch: {} env: CARGO_TERM_COLOR: always @@ -103,4 +104,29 @@ jobs: - name: Build with all features run: cargo test --verbose --all-features --no-run - name: Tests with all features - run: cargo test --verbose --all-features \ No newline at end of file + run: cargo test --verbose --all-features + + 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 + - name: Generate coverage report + run: cargo llvm-cov report --codecov --output-path coverage.json + - name: Upload coverage to codecov.io + uses: codecov/codecov-action@v3 + with: + files: coverage.json + name: ubuntu + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 8ae909d..d5a3750 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ portgraph [![build_status][]](https://github.com/CQCL/portgraph/actions) [![crates][]](https://crates.io/crates/portgraph) [![msrv][]](https://github.com/CQCL/portgraph) +[![codecov][]](https://codecov.io/gh/CQCL/portgraph) Data structure library for directed graphs with first-level ports. Includes secondary data structures for node and port weights, and node hierarchies. @@ -35,4 +36,5 @@ This project is licensed under Apache License, Version 2.0 ([LICENSE][] or http: [crates]: https://img.shields.io/crates/v/portgraph [LICENSE]: LICENCE [msrv]: https://img.shields.io/badge/rust-1.70.0%2B-blue.svg?maxAge=3600 + [codecov]: https://img.shields.io/codecov/c/gh/CQCL/portgraph?logo=codecov [CHANGELOG]: CHANGELOG.md \ No newline at end of file