-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
299 lines (277 loc) · 12.8 KB
/
.gitlab-ci.yml
File metadata and controls
299 lines (277 loc) · 12.8 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo-home
# Set Gitlab's cache compression to tar+zstd for better performance.
CACHE_COMPRESSION_FORMAT: tarzstd
COVERAGE_REPORT: true
# Enable timestamps in Gitlab's job logs.
FF_TIMESTAMPS: true
RUST_BACKTRACE: full
# Pull git submodules. Needed for
# - The lint-website linkita theme.
GIT_SUBMODULE_STRATEGY: normal
stages:
- check
- test
- publish
- report
- pages
# default setup running on default branch and in MRs
.default:
before_script:
- pacman-key --init
- pacman -Sy --needed --noconfirm archlinux-keyring just
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_PIPELINE_SOURCE == "schedule"
# default setup with Rust tools running on default branch and in MRs
.default-with-rust:
extends: .default
before_script:
- pacman-key --init
- pacman -Sy --needed --noconfirm archlinux-keyring just
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'rust-dev'"
- just install-alpm-package-set rust-dev
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "install-rust-dev-tools" "Install Rust development tools"
- just install-rust-dev-tools
- just --justfile .gitlab/justfile section-end "install-rust-dev-tools"
commits:
extends: .default
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'commits'"
- just install-alpm-package-set commits
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
# fetch the default branch as we need it for comparison
- git fetch origin $CI_DEFAULT_BRANCH
# setup a dummy user as `cog verify` needs that
- git config --local user.name "Foobar McFooface"
- git config --local user.email "foobar@mcfooface.com"
- just --justfile .gitlab/justfile section-start "check-commits" "Check commits"
- just check-commits
- just --justfile .gitlab/justfile section-end "check-commits"
stage: check
spelling:
extends: .default
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'spelling'"
- just install-alpm-package-set spelling
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-spelling" "Check spelling in all files"
- just check-spelling
- just --justfile .gitlab/justfile section-end "check-spelling"
stage: check
formatting:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'formatting'"
- just install-alpm-package-set formatting
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-formatting" "Check source file formatting"
- just check-formatting
- just --justfile .gitlab/justfile section-end "check-formatting"
stage: check
shell-code:
extends: .default
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'shell'"
- just install-alpm-package-set shell
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-shell-code" "Check shell code"
- just check-shell-code
- just --justfile .gitlab/justfile section-end "check-shell-code"
stage: check
rust-code:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'rust'"
- just install-alpm-package-set rust
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-rust-code" "Check Rust code"
- just check-rust-code
- just --justfile .gitlab/justfile section-end "check-rust-code"
stage: check
python-code:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'python-dev'"
- just install-alpm-package-set python-dev
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-python-code" "Check Python code"
- just check-python-code
- just --justfile .gitlab/justfile section-end "check-python-code"
stage: check
unused-deps:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'unused'"
- just install-alpm-package-set unused
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-unused-deps" "Check for unused Rust dependencies"
- just check-unused-deps
- just --justfile .gitlab/justfile section-end "check-unused-deps"
stage: check
dependencies:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'dependencies'"
- just install-alpm-package-set dependencies
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-dependencies" "Check Rust dependencies"
- just check-dependencies
- just --justfile .gitlab/justfile section-end "check-dependencies"
stage: check
licenses:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'licenses'"
- just install-alpm-package-set licenses
# We have to explicitly init the git submodule again as otherwise REUSE won't detect it for some reason.
# GitLab seems to do some weird submodule initialization.
- git submodule update --init
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-licenses" "Check licenses"
- just check-licenses
- just --justfile .gitlab/justfile section-end "check-licenses"
stage: check
build-book-and-links:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'book'"
- just install-alpm-package-set book
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "build-book" "Build project documentation"
- just build-book
- just --justfile .gitlab/justfile section-end "build-book"
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'links'"
- just install-alpm-package-set links
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "check-links" "Check links in all files"
- just check-links
- just --justfile .gitlab/justfile section-end "check-links"
stage: check
test:
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: target/llvm-cov/cobertura-coverage.xml
# Expose the code coverage as a GitLab metric.
# This allows us to easily spot changes in the overall coverage.
metrics: target/llvm-cov/coverage-metrics.txt
coverage: "/Test-coverage: ([0-9.]*)%/"
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'coverage'"
- just install-alpm-package-set coverage
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "test" "Run unit tests"
- just test
- just --justfile .gitlab/justfile section-end "test"
- just --justfile .gitlab/justfile section-start "test" "Run unit tests with cli"
- just test --features cli
- just --justfile .gitlab/justfile section-end "test"
- just --justfile .gitlab/justfile section-start "test-docs" "Run doc tests"
- just test-docs
- just --justfile .gitlab/justfile section-end "test-docs"
- just --justfile .gitlab/justfile section-start "test-python" "Run Python tests"
- just test-python
- just --justfile .gitlab/justfile section-end "test-python"
- just --justfile .gitlab/justfile section-start "create-coverage-report" "Create coverage report"
- just create-coverage-report with-docs Unit-test-coverage
- just --justfile .gitlab/justfile section-end "create-coverage-report"
stage: test
docs:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'docs'"
- just install-alpm-package-set docs
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "docs" "Build Rust API documentation"
- just docs
- just --justfile .gitlab/justfile section-end "docs"
stage: test
test-readmes:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'readmes'"
- just install-alpm-package-set readmes
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "test-readmes" "Run README tests"
- just test-readmes
- just --justfile .gitlab/justfile section-end "test-readmes"
stage: test
alpm-lint-website:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'lint-website'"
- just install-alpm-package-set lint-website
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "lint-website" "Lint website"
- just --justfile alpm-lint-website/justfile lint
- just --justfile .gitlab/justfile section-end "lint-website"
stage: check
build-python:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'python-dev'"
- just install-alpm-package-set python-dev
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "build-python" "Prepare Python sdist and build wheels"
- just build-python all
- just --justfile .gitlab/justfile section-end "build-python"
stage: test
manpages-specs-completions:
extends: .default-with-rust
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'manpages'"
- just install-alpm-package-set manpages
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "generate-manpages-and-specs" "Generate man pages and specifications"
- just generate-manpages-and-specs
- just --justfile .gitlab/justfile section-end "generate-manpages-and-specs"
- just --justfile .gitlab/justfile section-start "generate-completions" "Generate shell completions"
- just generate-completions
- just --justfile .gitlab/justfile section-end "generate-completions"
stage: test
publish-to-registry:
extends: .default-with-rust
dependencies: []
rules:
- if: '$UV_PUBLISH_TOKEN && $CI_COMMIT_TAG && $CI_PROJECT_PATH == "archlinux/alpm/alpm"'
- if: '$CARGO_REGISTRY_TOKEN && $CI_COMMIT_TAG && $CI_PROJECT_PATH == "archlinux/alpm/alpm"'
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'publish'"
- just install-alpm-package-set publish
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "ci-publish" "Publish a crate on crates.io"
- just ci-publish
- just --justfile .gitlab/justfile section-end "ci-publish"
stage: publish
tags:
- secure
issue-bot:
image: registry.gitlab.com/gitlab-org/distribution/issue-bot:latest
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_failure
script: /issue-bot
stage: report
pages:
artifacts:
paths:
- output/docs
extends: .default-with-rust
publish: output/docs
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- just --justfile .gitlab/justfile section-start "install-alpm-packages" "Install ALPM package set 'book'"
- just install-alpm-package-set book
- just --justfile .gitlab/justfile section-end "install-alpm-packages"
- just --justfile .gitlab/justfile section-start "build-book" "Build project documentation"
- just build-book
- just --justfile .gitlab/justfile section-end "build-book"
stage: pages