Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Implement branch coverage using llcov #16

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
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
- uses: actions/checkout@v4

- name: Install Rust
run: rustup update stable

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-version }}
toolchain: stable # Specify the Rust toolchain 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

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

# Explicitly build the collections contract first
- name: Build Collections Contract
run: make build

- 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: codecov.json # Changed from lcov.info to codecov.json based on the Generate code coverage step
fail_ci_if_error: true

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS := contracts/collections contracts/deployer
SUBDIRS := contracts/deployer contracts/collections
BUILD_FLAGS ?=

default: build
Expand Down
Loading