mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-03 06:23:11 +00:00
61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
name: Codecov
|
|
|
|
jobs:
|
|
test-and-coverage:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
RUSTFLAGS: "-C instrument-coverage"
|
|
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
|
|
|
|
steps:
|
|
# Checkout the repo
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Install Rust toolchain (stable)
|
|
- name: Set up Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: stable
|
|
components: llvm-tools-preview
|
|
|
|
# Build and test with coverage instrumentation
|
|
- name: Run tests
|
|
run: |
|
|
cargo build --all-features
|
|
cargo test --all-features
|
|
|
|
# Install grcov
|
|
- name: Install grcov
|
|
run: cargo install grcov
|
|
|
|
# Generate lcov report
|
|
- name: Generate coverage report
|
|
run: |
|
|
mkdir -p coverage
|
|
grcov . \
|
|
--binary-path ./target/debug/ \
|
|
-s . \
|
|
-t lcov \
|
|
--branch \
|
|
--ignore-not-existing \
|
|
--ignore '../*' \
|
|
--ignore "/*" \
|
|
-o coverage/tests.lcov
|
|
|
|
# Upload to Codecov
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }} # only needed for private repos
|
|
files: coverage/tests.lcov
|
|
fail_ci_if_error: true
|
|
flags: unittests
|
|
name: rust-codecov |