forked from akubera/bigdecimal-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
163 lines (130 loc) · 3.27 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
cache:
policy: pull-push
# should we only share cache between jobs on one tag?
# key: ${CI_COMMIT_REF_SLUG}
paths:
- .cargo/registry/index
- .cargo/registry/cache
- target/debug/deps
- target/debug/build
variables:
# store cargo registry in the project directory
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
# this fixes an error when updating cargo registry
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
.cargo:build-script: &cargo-build-script
script:
- rustc --version && cargo --version
- cargo build
.cargo-test-script: &cargo-test-script
script:
- rustc --version && cargo --version
- cargo test --verbose
cargo:build-stable:
stage: build
image: "rust:latest"
<<: *cargo-build-script
cargo:test-stable:
stage: test
image: "rust:latest"
needs:
- "cargo:build-stable"
<<: *cargo-build-script
cargo:build-nightly:
stage: build
image: rustlang/rust:nightly
allow_failure: true
<<: *cargo-build-script
cargo:test-nightly:
stage: test
image: rustlang/rust:nightly
needs:
- cargo:build-nightly
allow_failure: true
<<: *cargo-test-script
cargo:build-1.43:
stage: build
image: "akubera/rust-kcov:1.43.1-buster"
<<: *cargo-build-script
cargo:test-1.43:
stage: test
needs:
- "cargo:build-1.43"
image: "akubera/rust-kcov:1.43.1-buster"
<<: *cargo-test-script
cargo:build-1.54:
stage: build
image: "akubera/rust-kcov:1.54.0-bullseye"
<<: *cargo-build-script
cargo:test-1.54:
stage: test
needs:
- "cargo:build-1.54"
image: "akubera/rust-kcov:1.54.0-bullseye"
<<: *cargo-test-script
cargo:build-1.70:
stage: build
image: "akubera/rust-grcov:1.70.0-bullseye"
<<: *cargo-build-script
cargo:test-1.70:
stage: test
needs:
- "cargo:build-1.70"
image: "akubera/rust-grcov:1.70.0-bullseye"
<<: *cargo-test-script
coverage-test:
stage: test
needs:
- "cargo:test-1.70"
image: "akubera/rust-grcov:1.70.0-bullseye"
variables:
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw"
RUSTFLAGS: "-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off "
# RUSTDOCFLAGS: "-Cpanic=abort"
CARGO_INCREMENTAL: "0"
coverage: '/Code Coverage: \d+\.\d+/'
script:
- rustc --version && cargo --version
- cargo test
- ls -l target/coverage
- grcov target/coverage --binary-path target/debug -s . --keep-only 'src/*' -tcobertura -o cobertura.xml
- >
grep -m1 -o 'line-rate="[^"]*' cobertura.xml
| sed 's/[^0-9.]*//'
| awk '{ print "Code Coverage: " $0 * 100 }'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
cargo:benchmark:
stage: test
needs:
- "cargo:test-1.70"
image: "akubera/bigdecimal-benchmark-base:1.70.0-bullseye"
when: manual
allow_failure: true
cache: []
variables:
CARGO_HOME: /usr/local/cargo
BENCHMARK_EXTRAS: 1
script:
- scripts/benchmark-bigdecimal
artifacts:
expose_as: 'criterion-benchmark-report'
paths:
- target/criterion
- "*.html"
cargo-publish:
stage: deploy
image: "rust:latest"
when: manual
only:
- master
allow_failure: true
cache: []
variables:
CARGO_HOME: /usr/local/cargo
script:
- cargo publish