Skip to content

added keep-only argument to grcov #22

added keep-only argument to grcov

added keep-only argument to grcov #22

Workflow file for this run

name: Rust
on:
push:
branches: [ "main", "development" ]
pull_request:
branches: [ "main", "development" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Set up coverage path
run: echo "COVERAGE_PATH=${GITHUB_WORKSPACE}/coverage/coverage/lcov.info" >> $GITHUB_ENV
if: runner.os == 'Linux' || runner.os == 'macOS'
- name: Set up coverage path for Windows
run: |
echo "COVERAGE_PATH=${GITHUB_WORKSPACE}/coverage/lcov.info" >> $GITHUB_ENV
mkdir -p D:/coverage
echo $COVERAGE_PATH
if: runner.os == 'Windows'
- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up environment for code coverage
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "RUSTFLAGS=-C instrument-coverage" >> $GITHUB_ENV
echo "LLVM_PROFILE_FILE=${{ github.workspace }}/coverage/%p-%m.profraw" >> $GITHUB_ENV
- name: Install LLVM tools
run: rustup component add llvm-tools-preview
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Collecting code coverage
run: |
cargo install grcov
grcov ${GITHUB_WORKSPACE}/coverage/ -b ./target/debug/deps/ -s . --keep-only ./src/* -t lcov --llvm --branch --ignore-not-existing --output-path ${{ env.COVERAGE_PATH }} --token ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.COVERAGE_PATH }}
flag-name: run-${{ matrix.rust }}
parallel: true
finish:
name: Finish submitting coverage
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
continue-on-error: true
with:
parallel-finished: true