-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
169 lines (150 loc) · 4.18 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
164
165
166
167
168
169
include:
- local: /.gitlab-templates/install-just.yml
- local: /.gitlab-templates/sanitizer.yml
- local: /.gitlab-templates/lint.yml
image: "rust:latest"
default:
before_script:
- hostname -I
- whoami
- rustc --version
- cargo --version
# Set any required environment variables here (defaults)
variables:
RUST_BACKTRACE: "FULL"
CARGO_TERM_COLOR: "always"
CARGO_TERM_VERBOSE: "true"
stages:
- code-quality
- build
- test
- benchmark
### Code quality ###
pre-commit:
image: python:3.12
stage: code-quality
before_script: pip install pre-commit
script: pre-commit run --all-files --show-diff-on-failure
lint:
stage: code-quality
extends: .lint
lint-nightly:
stage: code-quality
extends: .lint
image: rustlang/rust:nightly
allow_failure: true
audit:
stage: code-quality
script:
- cargo install cargo-audit
- cargo audit
### Test compilation ###
build-msrv:
stage: build
script:
- cargo install cargo-msrv
- cargo msrv --path fastpasta verify
build-default-debug:
stage: build
script: cargo build
build-default-release:
stage: build
script: cargo build --release
build-nightly-debug:
stage: build
image: rustlang/rust:nightly
script: cargo build
allow_failure: true
build-nightly-release:
stage: build
image: rustlang/rust:nightly
script: cargo build --release
allow_failure: true
### Tests and safety ###
rust-nightly-test:
stage: test
image: rustlang/rust:nightly
allow_failure: true
extends: .install-just
script: just test --verbose
# Run tests and calculate code coverage
test-coverage:
stage: test
image: rustlang/rust:nightly
extends: .install-just
script:
- rustup +nightly component add llvm-tools-preview
- cargo install grcov
- apt-get update && apt-get install -y libxml2-utils
- just test-coverage
coverage: '/Coverage: \d+(?:\.\d+)?/'
dependencies: []
cache: []
artifacts:
paths:
- target/coverage/
reports:
coverage_report:
coverage_format: cobertura
path: target/coverage/cobertura.xml
## Safety
# Only includes address and leak sanitizing now, as there's simply too many false positives with memory and thread sanitizing on Rust code.
leak-sanitizer:
extends: [.install-just, .sanitizer-test]
script:
- !reference [.sanitizer-test, script]
- just test-lsan
address-sanitizer:
extends: [.install-just, .sanitizer-test]
script:
- !reference [.sanitizer-test, script]
- just test-asan
# Run benchmarks and check for performance regression
limited-regress-bench:
needs: [lint, pre-commit]
stage: benchmark
extends: .install-just
rules:
# Run this job when a tag is created
- if: $CI_COMMIT_TAG
when: never
# Never create if the suffix is -bench (we're doing extended benchmarks then)
- if: $CI_COMMIT_BRANCH =~ /^.*-bench$/
when: never
# Don't create it in the MR pipeline (only use branch pipelines)
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
# Create this job if branch suffix is not -bench (that unlocks the extended benchmark)
- if: $CI_COMMIT_BRANCH !~ /^.*-bench$/
when: always
dependencies: []
cache: []
before_script:
- !reference [.install-just, before_script]
script: just bench "check sanity; check all; check all its; check all its-stave"
# Run benchmarks and check for performance regression with bigger and more files than the limited job
extended-regress-bench:
needs: []
stage: benchmark
extends: .install-just
timeout: 3h 30m
rules:
# Run this job when a tag is created
- if: $CI_COMMIT_TAG
when: always
# Don't create the job if commit message contains [skip-bench]
- if: $CI_COMMIT_MESSAGE =~ /\[.*skip-bench.*\]/
when: never
# Create job for a merge commit to the normal MR target branch of the project ("master").
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
# Allow manual creation of job if branch suffix is -bench
- if: $CI_COMMIT_BRANCH =~ /^.*-bench$/
when: manual
allow_failure: true
dependencies: []
cache: []
interruptible: true
before_script:
- !reference [.install-just, before_script]
script: just bench-extended