Skip to content

Commit

Permalink
Track code coverage with cargo-llvm-cov and codecov.io (#277)
Browse files Browse the repository at this point in the history
* Track code coverage with `cargo-llvm-cov`

* Add changelog entry

* Add coverage badge to the README
  • Loading branch information
romac authored and plafer committed Dec 5, 2022
1 parent 14fa3f8 commit f13f480
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/277-code-coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Track code coverage with `cargo-llvm-cov`
([#277](https://github.com/cosmos/ibc-rs/issues/277))
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f13f480

Please sign in to comment.