fix: code-coverage job #29
This file contains hidden or 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: ci | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- "src/**" | |
- "tests/**" | |
- ".github/workflows/**" | |
pull_request: | |
branches: ["main"] | |
paths: | |
- "src/**" | |
- "tests/**" | |
- ".github/workflows/**" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
ci: | |
name: ci | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Run clippy | |
run: cargo clippy -- -D warnings | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
coverage: | |
name: code-coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup toolchain install stable --component llvm-tools | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --tests --lcov --output-path lcov.info | |
- name: Upload coverage to coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: lcov.info |