Skip to content

Commit def20cb

Browse files
committed
test: add coveralls
1 parent 63b33b1 commit def20cb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
runs-on: ubuntu-latest
9292
steps:
9393
- uses: actions/checkout@v4
94+
- uses: taiki-e/install-action@cargo-llvm-cov
9495
- uses: Swatinem/rust-cache@v2
9596
with:
9697
cache-on-failure: true
@@ -102,7 +103,17 @@ jobs:
102103
run: scripts/install-ubuntu-packages
103104
# Checks begin here!
104105
- run: cargo fmt --all --check
105-
- run: cargo test --locked
106+
#- run: cargo test --locked # replaced by cargo llvm-cov to run with coverage tests
106107
- run: cargo clippy --locked --all-targets
107108
- run: cargo build --locked --all-targets
108109
- run: cargo doc --no-deps --locked
110+
- name: unit tests with coverage
111+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info --locked
112+
- name: Upload coverage artifact
113+
uses: actions/upload-artifact@v4
114+
with:
115+
path: lcov.info
116+
- name: Send to coveralls
117+
uses: coverallsapp/github-action@v2.3.4
118+
with:
119+
github-token: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ If you're thinking of contributing something non-trivial, it might be best to ra
1414
* Changes should normally be based on the `dev` branch. _(Exception: hotfixes may be branched against `main`.)_
1515
* PRs must pass the full set of CI checks (see below). No exceptions.
1616
* Unit tests are encouraged, particularly those which fail before and pass after a fix.
17+
* The CI workflow runs code coverage analysis.
1718
* Refactoring for its own sake is OK if driven by a feature or bugfix.
1819
* Clean commit histories are preferred, but don't be discouraged if you don't know how to do this. git can be a tricky tool.
1920
* Commit messages should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
@@ -32,6 +33,7 @@ If you're thinking of contributing something non-trivial, it might be best to ra
3233
| Unit tests pass | `cargo test` |
3334
| Lints | `cargo clippy --all-targets` | This is a reasonably pedantic set of lints, which I make no apologies for |
3435
| Docs build | `cargo doc --no-deps` |
36+
| Code coverage | `./scripts/coverage`, then examine `target/coverage/html` |
3537

3638

3739
[issue]: https://github.com/crazyscot/qcp/issues/new/choose

0 commit comments

Comments
 (0)