From cf2515c0992e4263e5daff661507f386aae79edb Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Thu, 1 Dec 2022 17:04:55 +0100 Subject: [PATCH 1/3] Track code coverage with `cargo-llvm-cov` --- .github/workflows/coverage.yml | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..e56aa336a --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,52 @@ +name: Coverage +on: + pull_request: + paths: + - .github/workflows/rust.yml + - .github/workflows/coverage.yml + - Cargo.toml + - ci/** + - crates/** + push: + branches: + - master + +permissions: + contents: read + +concurrency: + group: rust-ci-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_INCREMENTAL: 0 + CARGO_PROFILE_DEV_DEBUG: 1 + CARGO_PROFILE_RELEASE_DEBUG: 1 + RUST_BACKTRACE: short + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + CARGO_TERM_COLOR: always + +jobs: + coverage: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + - name: Generate code coverage + run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: lcov.info + fail_ci_if_error: true + From b2a45621fa5af1a46d209872628e5b0d8ba13a57 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Thu, 1 Dec 2022 17:13:45 +0100 Subject: [PATCH 2/3] Add changelog entry --- .changelog/unreleased/improvements/277-code-coverage.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/improvements/277-code-coverage.md diff --git a/.changelog/unreleased/improvements/277-code-coverage.md b/.changelog/unreleased/improvements/277-code-coverage.md new file mode 100644 index 000000000..dfb3273b8 --- /dev/null +++ b/.changelog/unreleased/improvements/277-code-coverage.md @@ -0,0 +1,2 @@ +- Track code coverage with `cargo-llvm-cov` + ([#277](https://github.com/cosmos/ibc-rs/issues/277)) \ No newline at end of file From 8444330c13bdbfd68a5de5c02d943c8568532d2d Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Thu, 1 Dec 2022 17:18:12 +0100 Subject: [PATCH 3/3] Add coverage badge to the README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 439e5d955..f98c71baf 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Docs][docs-image]][docs-link] [![Build Status][build-image]][build-link] +[![Code Coverage][codecov-image]][codecov-link] [![Apache 2.0 Licensed][license-image]][license-link] ![Rust Stable][rustc-image] ![Rust 1.60+][rustc-version] @@ -51,6 +52,8 @@ CONDITIONS OF ANY KIND, either express or implied. See the License for the speci [docs-link]: https://docs.rs/ibc/ [build-image]: https://github.com/cosmos/ibc-rs/workflows/Rust/badge.svg [build-link]: https://github.com/cosmos/ibc-rs/actions?query=workflow%3ARust +[codecov-image]: https://codecov.io/gh/cosmos/ibc-rs/branch/main/graph/badge.svg?token=wUm2aLCOu +[codecov-link]: https://codecov.io/gh/cosmos/ibc-rs [license-image]: https://img.shields.io/badge/license-Apache2.0-blue.svg [license-link]: https://github.com/cosmos/ibc-rs/blob/main/LICENSE [rustc-image]: https://img.shields.io/badge/rustc-stable-blue.svg