Commit 86cb1d9d authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'add-tarpaulin'

89763392 gitlab-ci: add tarpaulin for coverage
2a04b2d6 gitlab-ci: only run CI for MRs and main branches
be2b4ddf

 gitlab-ci: use a better tag structure
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !184
parents da7700f2 89763392
......@@ -7,11 +7,10 @@ before_script:
- rustc --version
- cargo --version
.rust_tags: &rust_tags
- rust
- docker
- ghostflow
- linux
.only_settings: &only_settings
- merge_requests
- branches@utils/rust-git-workarea
- tags@utils/rust-git-workarea
.cargo_update: &cargo_update
- cargo generate-lockfile $GENERATE_LOCKFILE_ARGS
......@@ -38,6 +37,18 @@ before_script:
.cargo_test: &cargo_test
- cargo test --frozen --all --verbose
.cargo_tarpaulin_build: &cargo_tarpaulin_build
- .gitlab/ci/sccache.sh && export RUSTC_WRAPPER=$PWD/.gitlab/sccache
- .gitlab/ci/tarpaulin.sh
- export PATH=$PWD/.gitlab:$PATH
- cargo tarpaulin --no-run --frozen --exclude-files vendor --ignore-panics --all --verbose
- ".gitlab/sccache --show-stats || :"
.cargo_tarpaulin_test: &cargo_tarpaulin_test
- .gitlab/ci/tarpaulin.sh
- export PATH=$PWD/.gitlab:$PATH
- cargo tarpaulin --frozen --exclude-files vendor --ignore-panics --all --verbose
.rust_minimum: &rust_minimum
image: "rust:1.36.0"
......@@ -59,7 +70,13 @@ before_script:
.cargo_fetch_job: &cargo_fetch_job
stage: prepare
tags: *rust_tags
only: *only_settings
tags:
- build
- docker
- ghostflow
- linux
script: *cargo_update
artifacts:
expire_in: 60m
......@@ -75,13 +92,23 @@ before_script:
.cargo_clippy_job: &cargo_clippy_job
stage: build
tags: *rust_tags
only: *only_settings
tags:
- build
- docker
- ghostflow
- linux
script: *cargo_clippy
interruptible: true
.cargo_build_job: &cargo_build_job
stage: build
tags: *rust_tags
only: *only_settings
tags:
- build
- docker
- ghostflow
- linux
script: *cargo_build
artifacts:
expire_in: 60m
......@@ -94,10 +121,45 @@ before_script:
.cargo_test_job: &cargo_test_job
stage: test
tags: *rust_tags
only: *only_settings
tags:
- build
- docker
- ghostflow
- linux
script: *cargo_test
interruptible: true
.cargo_tarpaulin_build_job: &cargo_tarpaulin_build_job
stage: build
only: *only_settings
tags:
- build
- docker
- ghostflow
- linux
script: *cargo_tarpaulin_build
artifacts:
expire_in: 60m
paths:
- vendor
- .cargo
- Cargo.lock
- target
interruptible: true
.cargo_tarpaulin_test_job: &cargo_tarpaulin_test_job
stage: test
only: *only_settings
tags:
- docker
- ghostflow
- linux
- privileged
script: *cargo_tarpaulin_test
coverage: '/\d+.\d+% coverage, \d+\/\d+ lines covered/'
interruptible: true
stages:
- prepare
- build
......@@ -158,6 +220,21 @@ test:cargo-stable:
needs:
- build:cargo-stable
build:cargo-tarpaulin:
<<:
- *cargo_tarpaulin_build_job
- *rust_stable
- *cargo_cache_newest
test:cargo-tarpaulin:
<<:
- *cargo_tarpaulin_test_job
- *rust_stable
dependencies:
- build:cargo-tarpaulin
needs:
- build:cargo-tarpaulin
build:cargo-nightly:
<<:
- *cargo_build_job
......
#!/bin/sh
set -e
readonly version="0.10.0"
readonly sha256sum="6843be8384bf14385b36a3118efc1ed2d25d531acb8df954cd3f93d44018b09e"
readonly filename="cargo-tarpaulin-$version-travis"
readonly tarball="$filename.tar.gz"
cd .gitlab
echo "$sha256sum $tarball" > tarpaulin.sha256sum
curl -OL "https://github.com/xd009642/tarpaulin/releases/download/$version/$tarball"
sha256sum --check tarpaulin.sha256sum
tar xf "$tarball"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment