Skip to content

fix grcov 6

fix grcov 6 #114

Workflow file for this run

name: coverage
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
grcov:
name: Coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
toolchain:
- nightly
cargo_flags:
- "--all-features"
steps:
- name: Checkout source code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Install npm dependencies
run: npm ci
- name: Build WebUI
run: npm run build
- name: Setup ffmpeg
uses: AnimMouse/setup-ffmpeg@v1
- name: Show version information
run: |
ffmpeg -version
ffprobe -version
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- name: "`grcov` ~ install"
run: cargo install grcov
- name: Execute tests
run: cargo test --no-fail-fast --locked --all-targets ${{ matrix.extra_args }}
env:
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cprofile-generate=target/debug"
# - name: Test
# uses: actions-rs/cargo@v1
# with:
# command: test
# args: --all --no-fail-fast ${{ matrix.cargo_flags }}
# env:
# CARGO_INCREMENTAL: "0"
# RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off'
# RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off'
# - name: Generate coverage data (via `grcov`)
# id: coverage
# shell: bash
# run: |
# ## Generate coverage data
# COVERAGE_REPORT_DIR="target/debug"
# COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
# # GRCOV_IGNORE_OPTION='--ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*"' ## `grcov` ignores these params when passed as an environment variable (why?)
# # GRCOV_EXCLUDE_OPTION='--excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"' ## `grcov` ignores these params when passed as an environment variable (why?)
# mkdir -p "${COVERAGE_REPORT_DIR}"
# # display coverage files
# grcov . --output-type files --ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
# # generate coverage report
# grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
# echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
#
# - name: Upload coverage results (to Codecov.io)
# uses: codecov/codecov-action@v4
# with:
# file: ${{ steps.coverage.outputs.report }}
# ## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
# flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
# fail_ci_if_error: false
# token: ${{ secrets.CODECOV_TOKEN }}
- name: Generate coverage data
run: |
grcov target/debug/ \
--branch \
--llvm \
--source-dir . \
--output-path lcov.info \
--ignore='/**' \
--ignore='C:/**' \
--ignore='../**' \
--ignore-not-existing \
--excl-line "#\\[derive\\(" \
--excl-br-line "#\\[derive\\(" \
--excl-start "#\\[cfg\\(test\\)\\]" \
--excl-br-start "#\\[cfg\\(test\\)\\]" \
--commit-sha ${{ github.sha }} \
--service-job-id ${{ github.job }} \
--service-name "GitHub Actions" \
--service-number ${{ github.run_id }}
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
file: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}