Skip to content

Commit

Permalink
CI: Implement branch coverage using llcov
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Sep 5, 2024
1 parent e5a7759 commit 56a9100
Showing 1 changed file with 16 additions and 35 deletions.
51 changes: 16 additions & 35 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
on:
push:
branches:
- main

name: Code coverage check

jobs:
on: [pull_request, push]

jobs:
coverage:
name: Code Coverage
# https://github.com/actions/virtual-environments
runs-on: ubuntu-20.04
strategy:
matrix:
rust-version: [1.78.0]
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
override: true
- name: Install tarpaulin
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-tarpaulin --version 0.30.0
- run: make build
- name: Run code coverage check with tarpaulin
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --workspace --timeout 120 --out Xml --exclude soroban-token-contract
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true

0 comments on commit 56a9100

Please sign in to comment.