From ff5b19f34a20ab8d54b71852f7f40bb8946081a3 Mon Sep 17 00:00:00 2001 From: v-lafeychine <vincent.lafeychine@proton.me> Date: Fri, 21 Oct 2022 10:49:06 +0200 Subject: [PATCH] =?UTF-8?q?Resolve=20"Coverage=20on=20Pipelines:=20Cache"?= =?UTF-8?q?=20=E2=9C=A8=EF=B8=8F=20Closes=20#23=20=F0=9F=90=94=EF=B8=8F?= =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🦀ï¸ðŸ°ðŸ¦€ï¸ðŸ°ðŸ¦€ï¸ðŸ° * fix(ci): Remove coverage files after tests --- .gitlab-ci.yml | 14 ++++++++++---- flake.nix | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07f65a40..254aa93a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,14 +8,19 @@ stages: variables: CARGO_HOME: "$CI_PROJECT_DIR/.cache/cargo/" + RUSTFLAGS: "-D warnings" cache: - key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" + key: "$CI_JOB_STAGE" paths: - .cache/cargo/ - target/ +default: + interruptible: true + format: + cache: [] stage: check script: - cargo fmt --check @@ -23,7 +28,7 @@ format: lint: stage: check script: - - cargo clippy --all-targets --all-features -- -D warnings + - cargo clippy --all-targets --all-features build: stage: build @@ -34,14 +39,15 @@ tests: stage: tests variables: CARGO_INCREMENTAL: 0 - LLVM_PROFILE_FILE: "coverage-%p-%m.profraw" + EXCLUDE_REGEXP: "unreachable!()|#\\[" RUSTDOCFLAGS: "-Cpanic=abort" RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" script: - 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%"/' + - find target \( -name "*.gcda" -or -name "*.gcno" \) -delete artifacts: reports: diff --git a/flake.nix b/flake.nix index ddfe9fdc..91fb2f0f 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ }; 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 { name = "proost-ci"; -- GitLab