Skip to content
Snippets Groups Projects
Verified Commit ff5b19f3 authored by v-lafeychine's avatar v-lafeychine Committed by v-lafeychine
Browse files

Resolve "Coverage on Pipelines: Cache" ✨️

Closes #23 🐔️👍️

🦀️🍰🦀️🍰🦀️🍰

* fix(ci): Remove coverage files after tests
parent 3ce80298
No related branches found
No related tags found
No related merge requests found
Pipeline #10866 passed with stages
in 2 minutes and 49 seconds
...@@ -8,14 +8,19 @@ stages: ...@@ -8,14 +8,19 @@ stages:
variables: variables:
CARGO_HOME: "$CI_PROJECT_DIR/.cache/cargo/" CARGO_HOME: "$CI_PROJECT_DIR/.cache/cargo/"
RUSTFLAGS: "-D warnings"
cache: cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" key: "$CI_JOB_STAGE"
paths: paths:
- .cache/cargo/ - .cache/cargo/
- target/ - target/
default:
interruptible: true
format: format:
cache: []
stage: check stage: check
script: script:
- cargo fmt --check - cargo fmt --check
...@@ -23,7 +28,7 @@ format: ...@@ -23,7 +28,7 @@ format:
lint: lint:
stage: check stage: check
script: script:
- cargo clippy --all-targets --all-features -- -D warnings - cargo clippy --all-targets --all-features
build: build:
stage: build stage: build
...@@ -34,14 +39,15 @@ tests: ...@@ -34,14 +39,15 @@ tests:
stage: tests stage: tests
variables: variables:
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw" EXCLUDE_REGEXP: "unreachable!()|#\\["
RUSTDOCFLAGS: "-Cpanic=abort" RUSTDOCFLAGS: "-Cpanic=abort"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
script: script:
- cargo test - cargo test
- grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore "*cargo*" --ignore-not-existing -o coverage.xml - grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore "*cargo*" --ignore-not-existing --excl-line ${EXCLUDE_REGEXP} --excl-br-line ${EXCLUDE_REGEXP} -o coverage.xml
- sed -n '3p' coverage.xml | grep -oE '[a-z-]+="[0-9](.[0-9]+)?"' | sed -r 's/(branch-rate|line-rate)="(0|(1)).([0-9]{2})([0-9]{2})[0-9]*"/\1="\3\4.\5%"/' - sed -n '3p' coverage.xml | grep -oE '[a-z-]+="[0-9](.[0-9]+)?"' | sed -r 's/(branch-rate|line-rate)="(0|(1)).([0-9]{2})([0-9]{2})[0-9]*"/\1="\3\4.\5%"/'
- find target \( -name "*.gcda" -or -name "*.gcno" \) -delete
artifacts: artifacts:
reports: reports:
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
}; };
docker-ci = let docker-ci = let
rust-ci = rust.minimal.override { extensions = [ "clippy" "llvm-tools-preview" "rustfmt" ]; }; rust-ci = rust.minimal.override { extensions = [ "clippy" "rustfmt" ]; };
in pkgs.dockerTools.buildImage { in pkgs.dockerTools.buildImage {
name = "proost-ci"; name = "proost-ci";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment