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: add code coverage #807

Merged
merged 3 commits into from
Jan 12, 2025
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
43 changes: 43 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
coverage:
status:
project:
default:
# basic
target: auto
threshold: 1%
base: auto
# advanced
branches:
- main
if_ci_failed: error
informational: false
only_pulls: false

patch:
default:
# basic
target: auto
threshold: 1%
base: auto
# advanced
branches:
- main
if_ci_failed: error
informational: false
only_pulls: false

ignore:
- "**/benches/**/*" # Ignore benchmarks
- "**/*_test.rs" # Ignore test files
- "**/tests/**/*" # Ignore test directories

github_checks:
annotations: true

comment:
layout: "diff, flags, files"
behavior: default
require_changes: false
require_base: false
require_head: true
hide_project_coverage: false
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,30 @@ jobs:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --all-features

coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --branch --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: hyperion-mc/hyperion

test:
name: Tests (${{ matrix.os }})
strategy:
Expand Down
Loading