Skip to content

Commit

Permalink
ci: Add codecov support
Browse files Browse the repository at this point in the history
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
  • Loading branch information
viccuad committed Feb 16, 2024
1 parent b979850 commit 696dd2c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,43 @@ jobs:
- name: run e2e tests
run: make e2e-tests

coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
- uses: taiki-e/install-action@5794068c211bc8f5f4514b7c3f03d6adbe66f1b7 # v2.26.18
with:
tool: cargo-tarpaulin
- name: Generate unit-tests coverage
run: make coverage-unit-tests
- name: Upload unit-tests coverage to Codecov
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
with:
name: unit-tests
directory: coverage/unit-tests
flags: unit-tests
verbose: true
- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0
- name: Generate e2e-tests coverage
run: make coverage-e2e-tests
- name: Upload e2e-tests coverage to Codecov
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
with:
name: e2e-tests
directory: coverage/e2e-tests
flags: e2e-tests
verbose: true

fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/target
/bin
bom-cargo.json

# coverage instrumentation:
*.profraw
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ test: fmt lint
.PHONY: e2e-tests
e2e-tests:
cargo test --test '*'

.PHONY: coverage
coverage: coverage-unit-tests coverage-e2e-tests

.PHONY: coverage-unit-tests
coverage-unit-tests:
cargo tarpaulin --verbose --skip-clean --engine=llvm \
--all-features --workspace --follow-exec \
--out xml --out html --output-dir coverage/unit-tests

.PHONY: coverage-e2e-tests
coverage-e2e-tests:
cargo tarpaulin --verbose --skip-clean --engine=llvm \
--all-features --test '*' --follow-exec \
--out xml --out html --output-dir coverage/e2e-tests

.PHONY: clean
clean:
Expand Down
4 changes: 4 additions & 0 deletions coverage/integration-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
4 changes: 4 additions & 0 deletions coverage/unit-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

0 comments on commit 696dd2c

Please sign in to comment.