Skip to content

Code Coverage

Code Coverage #622

Workflow file for this run

name: Code Coverage
on:
schedule:
- cron: '0 15 * * 0' # Sunday 15:00 UTC (7am or 8am Pacific time)
env:
RUST_BACKTRACE: 0
jobs:
codecov:
name: Run Code Coverage
runs-on: ubuntu-latest
env:
RUSTC_BOOTSTRAP: 1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Set up rust-cache
uses: Swatinem/rust-cache@v2
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
# Don't run tests in parallel because codecov with rayon will blow the stack.
args: --all --locked --profile ci --features only_testnet,leo-test-framework/no_parallel
env:
CARGO_INCREMENTAL: "0"
- name: Install dependencies for code coverage
run: |
sudo apt-get update
sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
- name: Generate coverage report
run: |
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
tar xzf master.tar.gz
cd kcov-master
mkdir build && cd build
cmake .. && make
make install DESTDIR=../../kcov-build
cd ../..
rm -rf kcov-master
for file in target/ci/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}