-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
50 lines (45 loc) · 1.29 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
default:
image: rust:latest
tags:
- shared-fi
before_script:
- apt update && apt install -y libasound2-dev
- apt install -y libxml2-utils
stages:
- build
- test
build:
stage: build
script:
- cargo build --verbose
lint:
stage: test
script:
- rustup component add rustfmt
- cargo fmt -- --check
- rustup component add clippy
- cargo clippy -- -D warnings -D clippy::pedantic -A clippy::missing_errors_doc
# https://github.com/mozilla/grcov
test:
image: "rustdocker/rust:nightly"
stage: test
variables:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
script:
- rustup component add llvm-tools-preview
- RUST_BACKTRACE=1 cargo test --verbose --features test
- cargo install grcov
- grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore *cargo* -o cobertura.xml
- xmllint --xpath '100 * string(//coverage/@line-rate)' cobertura.xml > coverage
- 'echo "Coverage: $(cat coverage)%"'
coverage: '/Coverage: \d+(?:\.\d+)?/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml