Skip to content

Commit

Permalink
ci: add code coverage (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka authored Jan 12, 2025
1 parent f9788b0 commit 299e79c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
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

0 comments on commit 299e79c

Please sign in to comment.