1
0
mirror of https://gitlab.com/MisterBiggs/aoc_2015-rust.git synced 2025-06-16 15:06:49 +00:00

trying to fix coverage

This commit is contained in:
Anson 2022-11-05 22:59:04 -06:00
parent 40727010d9
commit af6f32a9ce

View File

@ -101,26 +101,24 @@ test:
- cargo test --all - cargo test --all
coverage: coverage:
image: 'rustlang/rust:nightly-bullseye' image: "rustdocker/rust:nightly"
stage: test stage: extras
extends: .common
needs:
- job: check
artifacts: false
variables: variables:
RUSTFLAGS: "-Zinstrument-coverage" RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw" 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: script:
- cargo +nightly test - rustup component add llvm-tools-preview
- ./grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore "*cargo*" -o coverage.xml - cargo test
- grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }' # generate html report
coverage: '/Coverage: \d+\.\d+/' - 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: artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
expire_in: 2 days
reports: reports:
cobertura: coverage.xml coverage_report:
coverage_format: cobertura
path: cobertura.xml
coverage: '/^\d+.\d+% coverage/'