mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-05 23:43:11 +00:00
set a fresh new codecov action github workflow
This commit is contained in:
parent
8f650761f0
commit
0367f9ed18
83
.github/workflows/codecov.yml
vendored
83
.github/workflows/codecov.yml
vendored
@ -7,36 +7,65 @@ on:
|
|||||||
name: Codecov
|
name: Codecov
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test-and-coverage:
|
||||||
name: Test
|
|
||||||
env:
|
|
||||||
RUSTFLAGS: -C instrument-coverage
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
RUSTFLAGS: "-C instrument-coverage"
|
||||||
|
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
# 1️⃣ Checkout the repo
|
||||||
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # Version 4.2.2
|
- name: Checkout code
|
||||||
- name: Add llvm-tools-preview component
|
uses: actions/checkout@v4
|
||||||
run: rustup component add llvm-tools-preview
|
|
||||||
- name: Build required binaries
|
# 2️⃣ Install Rust toolchain (nightly required for coverage)
|
||||||
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72 # Version 1.0.1
|
- name: Set up Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
command: build
|
toolchain: nightly
|
||||||
args: --all-features
|
components: llvm-tools-preview
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
continue-on-error: true
|
# 3️⃣ Cache build artifacts for faster CI
|
||||||
- name: Install cargo-binstall
|
- name: Cache cargo build
|
||||||
run: cargo install cargo-binstall
|
uses: actions/cache@v4
|
||||||
- name: Run Grcov
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
# 4️⃣ Build and test with coverage instrumentation
|
||||||
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/cov;
|
cargo build --all-features
|
||||||
cargo binstall -y grcov;
|
cargo test --all-features
|
||||||
mkdir /tmp/cov;
|
|
||||||
grcov . --binary-path ./target/debug -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o /tmp/cov/tests.lcov;
|
# 5️⃣ Install grcov
|
||||||
- uses: codecov/codecov-action@v3
|
- name: Install grcov
|
||||||
|
run: cargo install grcov
|
||||||
|
|
||||||
|
# 6️⃣ 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
|
||||||
|
|
||||||
|
# 7️⃣ Upload to Codecov
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }} # only needed for private repos
|
||||||
directory: /tmp/cov/
|
files: coverage/tests.lcov
|
||||||
name: waku-bindings-codecov
|
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
flags: unittests
|
||||||
|
name: rust-codecov
|
||||||
Loading…
x
Reference in New Issue
Block a user