mirror of
https://gitlab.com/MisterBiggs/aoc_2015-rust.git
synced 2025-06-16 06:56:42 +00:00
trying to fix coverage
This commit is contained in:
parent
40727010d9
commit
af6f32a9ce
@ -101,26 +101,24 @@ test:
|
||||
- cargo test --all
|
||||
|
||||
coverage:
|
||||
image: 'rustlang/rust:nightly-bullseye'
|
||||
stage: test
|
||||
extends: .common
|
||||
needs:
|
||||
- job: check
|
||||
artifacts: false
|
||||
image: "rustdocker/rust:nightly"
|
||||
stage: extras
|
||||
variables:
|
||||
RUSTFLAGS: "-Zinstrument-coverage"
|
||||
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
|
||||
before_script:
|
||||
- rustup component add llvm-tools-preview
|
||||
- curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
|
||||
script:
|
||||
- cargo +nightly test
|
||||
- ./grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore "*cargo*" -o coverage.xml
|
||||
- grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }'
|
||||
coverage: '/Coverage: \d+\.\d+/'
|
||||
- rustup component add llvm-tools-preview
|
||||
- cargo test
|
||||
# generate html report
|
||||
- cargo install grcov
|
||||
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*cargo*" -o ./coverage/
|
||||
# generate cobertura report for gitlab integration
|
||||
- pip3 install lcov_cobertura
|
||||
- grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" -o coverage.lcov
|
||||
- python3 /usr/local/lib/python3.5/dist-packages/lcov_cobertura.py coverage.lcov
|
||||
artifacts:
|
||||
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
||||
expire_in: 2 days
|
||||
reports:
|
||||
cobertura: coverage.xml
|
||||
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: cobertura.xml
|
||||
coverage: '/^\d+.\d+% coverage/'
|
Loading…
x
Reference in New Issue
Block a user