Skip to content

Commit

Permalink
chore: generate coverage report (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud authored Aug 8, 2024
1 parent 426dd2d commit a0ca234
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-nextest
uses: taiki-e/cache-cargo-install-action@v2.0.1
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.3
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2.42.0
with:
tool: cargo-llvm-cov
- name: Run tests with coverage report
run: cargo llvm-cov --all-features --all-targets --lcov --workspace --output-path lcov.info
- name: Upload test coverage report
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: lcov.info

coverage:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: lcov.info
path: .
- uses: coverallsapp/github-action@v2.3.0
with:
tool: cargo-nextest
- run: cargo nextest run
base-path: /
file: lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ maybe_install_local() {

install_dev_deps() {
log "Installing development dependencies..."
crates="convco dprint cargo-nextest"
crates="convco dprint cargo-llvm-cov cargo-nextest"

for crate in $crates; do
maybe_install_local "$crate"
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CYAN := \033[36m
RESET := \033[0m
PATH := $(DEV_BIN_DIR):$(PATH)

.PHONY: help build build.docs fix fmt lint setup test
.PHONY: help build build.docs check commit coverage docs fix fmt lint setup test

help: ## display this help message (default task)
@printf "%b\n" "Usage: make [$(CYAN)task$(RESET)]"
Expand All @@ -25,6 +25,9 @@ check: ## check that all files match formatting rules
commit: ## make conventional commit
@PATH=$(PATH) convco commit

coverage: ## generate coverage report
@PATH=$(PATH) cargo llvm-cov --all-features report

docs: ## build & open the documentation in the browser
@cargo doc --no-deps --open --all-features

Expand All @@ -41,4 +44,4 @@ setup: ## run the setup script to install dependencies
@./.setup.sh

test: ## run all tests
@cargo-nextest ntr
@cargo-nextest ntr --all-features --all-targets --workspace

0 comments on commit a0ca234

Please sign in to comment.