test(coverage): migrate from tarpaulin to llvm-cov

This commit is contained in:
Ivan Gabriele
2024-03-05 02:30:09 +01:00
parent efcd93953a
commit 08b042506d
3 changed files with 7 additions and 3 deletions

View File

@@ -17,16 +17,19 @@ jobs:
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.76.0 toolchain: 1.76.0
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run documentation tests - name: Run documentation tests
run: make test-doc run: make test-doc
env: env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
- name: Run tests (with coverage) - name: Run tests (with coverage)
run: make test-cover run: cargo llvm-cov --lcov --output-path ./lcov.info
env: env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
- name: Upload tests coverage - name: Upload tests coverage
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@v4
with: with:
fail_ci_if_error: true fail_ci_if_error: true
files: ./lcov.info
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -38,7 +38,8 @@ Then edit the `.env` file to set your `MISTRAL_API_KEY`.
### Optional requirements ### Optional requirements
- [cargo-watch](https://github.com/watchexec/cargo-watch#install) for `make test-*-watch`. - [cargo-llvm-cov](https://github.com/taiki-e/cargo-llvm-cov?tab=readme-ov-file#installation) for `make test-cover`
- [cargo-watch](https://github.com/watchexec/cargo-watch#install) for `make test-watch`.
### Test ### Test

View File

@@ -38,7 +38,7 @@ release-major:
test: test:
@$(source_env_if_not_ci) && cargo test --no-fail-fast @$(source_env_if_not_ci) && cargo test --no-fail-fast
test-cover: test-cover:
@$(source_env_if_not_ci) && cargo tarpaulin --frozen --out Xml --skip-clean @$(source_env_if_not_ci) && cargo llvm-cov
test-doc: test-doc:
@$(source_env_if_not_ci) && cargo test --doc --no-fail-fast @$(source_env_if_not_ci) && cargo test --doc --no-fail-fast
test-watch: test-watch: