Skip to content

Commit

Permalink
Test different feature combinations with coverage.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Jul 16, 2022
1 parent 6510576 commit f136c71
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[alias]
coverage = 'llvm-cov --workspace nextest --open --output-dir ./target/coverage --workspace'
coverage_0 = ["llvm-cov", "--workspace", "nextest", "--no-report", "--output-dir", "./target/coverage", "--features", ""]
coverage_1 = ["llvm-cov", "--workspace", "nextest", "--no-report", "--output-dir", "./target/coverage", "--features", "unsafe_debug"]
coverage_open = 'llvm-cov --no-run --open --output-dir ./target/coverage'
File renamed without changes.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ jobs:
run: mkdir -p ./target/coverage

- name: 'Collect coverage'
uses: actions-rs/cargo@v1
with:
command: llvm-cov
args: --workspace nextest --workspace --lcov --output-path ./target/coverage/lcov.info
run: ./coverage.sh

- name: Upload to codecov.io
uses: codecov/codecov-action@v1
Expand Down
18 changes: 3 additions & 15 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
```bash
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov

# Optional: Use `nextest` to run tests
cargo install cargo-nextest
```


## Running Tests

```bash
cargo test --workspace
cargo nextest run --workspace
cargo nextest run --workspace --features "unsafe_debug"
```


Expand All @@ -24,23 +22,13 @@ cargo nextest run --workspace
Collect coverage and output as `html`.

```bash
cargo llvm-cov --workspace --open --output-dir ./target/coverage

# With `nextest`:
# https://github.com/taiki-e/cargo-llvm-cov/issues/151
cargo coverage
# This is an alias defined in `.cargo/config.toml` to:
cargo llvm-cov --workspace nextest --open --output-dir ./target/coverage --workspace
./coverage.sh && cargo coverage_open
```

Collect coverage and output as `lcov`.

```bash
cargo llvm-cov --workspace --lcov --output-path ./target/coverage/lcov.info

# With `nextest`:
# https://github.com/taiki-e/cargo-llvm-cov/issues/151
cargo llvm-cov --workspace nextest --workspace --lcov --output-path ./target/coverage/lcov.info
./coverage.sh
```


Expand Down
12 changes: 12 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash
set -euo pipefail

cargo llvm-cov clean --workspace
mkdir -p ./target/coverage

# See `.config/cargo.toml`
for i in {0..1}
do cargo coverage_$i
done

cargo llvm-cov --no-run --lcov --output-path ./target/coverage/lcov.info

0 comments on commit f136c71

Please sign in to comment.