From 56a91000eeaecf4d72fd556577e4d698b996ed7e Mon Sep 17 00:00:00 2001 From: Jakub Date: Thu, 5 Sep 2024 11:14:52 +0200 Subject: [PATCH] CI: Implement branch coverage using llcov --- .github/workflows/codecov.yml | 51 +++++++++++------------------------ 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index da8bb577..e87c2306 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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