This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: codecov | |
on: | |
push: | |
branches: [main, 0.4.x] | |
pull_request: | |
jobs: | |
# Run code coverage using cargo-llvm-cov then upload to codecov.io | |
job_code_coverage: | |
name: llvm-cov | |
runs-on: ubuntu-latest | |
env: | |
# `MSRV` should match project `cargo-llvm-cov` value for `rust-version` | |
MSRV: 1.64 | |
# set version outside of `Cargo.toml` to avoid `cargo-llvm-cov` dev-dependency | |
LLVM_COV_VERSION: 0.5.23 | |
COVERAGE_FILE: ./coverage.lcov | |
steps: | |
- uses: taiki-e/install-action@cargo-llvm-cov@v2.12.17 | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: toolchain ${{ env.MSRV }} minimal | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.MSRV }} | |
override: true | |
#- name: install cargo-llvm-cov | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: install | |
# args: cargo-llvm-cov --version ${{ env.LLVM_COV_VERSION }} | |
- name: add llvm-tools-preview | |
shell: bash | |
run: rustup component add llvm-tools-preview | |
- name: run llvm-cov | |
shell: bash | |
run: | | |
set -eux | |
cargo llvm-cov --version | |
cargo llvm-cov show-env | |
cargo llvm-cov --lcov --output-path "${COVERAGE_FILE}" | |
- name: upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ${{ env.COVERAGE_FILE }} | |
verbose: true | |
fail_ci_if_error: true |