This repository has been archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
279 lines (254 loc) · 8.14 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
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
.templates_sha: &templates_sha 79c325922670137e8f0a4dc5f6f097e0eb57c1af
include:
- project: "freedesktop/ci-templates"
ref: *templates_sha
file: "/templates/debian.yml"
variables:
FDO_UPSTREAM_REPO: dbus/zbus
UPSTREAM_BRANCH: "main"
RUST_BACKTRACE: "full"
RUST_LOG: "trace"
# If the MSRV needs to be updated, make sure to also change the
# rust-version fields in packages' Cargo.toml files.
MSRV: "1.60"
###
# IMPORTANT
# These are the version tags for the docker images the CI runs against.
# If you are hacking on them or need a them to rebuild, its enough
# to change any part of the string of the image you want.
###
WINDOWS_TAG: "2022-12-31.1"
WINDOWS_AMD64_SUFFIX: "amd64/windows"
WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$UPSTREAM_BRANCH"
WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$UPSTREAM_BRANCH"
stages:
- sanity check
- container
- lint
- test
- extras
- crosscheck
- pages
fail-if-fork-is-not-public:
stage: sanity check
script:
- |
if [ $CI_PROJECT_VISIBILITY != "public" ]; then
echo "*************************************************************************************"
echo "Project visibility must be set to 'public'"
echo "Change this in $CI_PROJECT_URL/edit under 'Visibility, project features, permissions'"
echo "*************************************************************************************"
exit 1
fi
except:
- main@dbus/zbus
.debian:
variables:
# Update this tag when you want to trigger a rebuild
FDO_DISTRIBUTION_TAG: "2023-04-15.1"
# Uncomment if you want to always rebuild the container, useful when hacking on it
#FDO_FORCE_REBUILD: 1
FDO_DISTRIBUTION_VERSION: 10
FDO_DISTRIBUTION_PACKAGES: >-
git
wget
ca-certificates
build-essential
libssl-dev
dbus
libglib2.0-dev
pkg-config
lcov
python3-pip
python3-setuptools
gcc-mingw-w64-x86-64
FDO_DISTRIBUTION_EXEC: >-
CI/install-rust.sh stable $MSRV &&
pip3 install lcov_cobertura &&
pip3 install codespell
before_script:
- source ./CI/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
# If cargo exists assume we probably will want to update
# the lockfile
- |
if command -v cargo; then
cargo generate-lockfile --color=always
cargo update --color=always
fi
container:
extends:
- .debian
- .fdo.container-build@debian
stage: container
windows amd64 docker:
stage: container
variables:
# this file needs to be relative to docker/windows/ subdir
# as it makes life easier in the powershell script
DOCKERFILE: "CI/docker/windows/Dockerfile"
timeout: 2h 30m
tags:
- windows
- shell
- "2022"
script:
# We need to pass an array and to resolve the env vars, so we can't use a variable:
- $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$UPSTREAM_BRANCH")
- "& CI/docker/windows/container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE $DOCKERFILE"
- |
if (!($?)) {
echo "Failed to build the image"
Exit 1
}
.debian_img:
extends:
- .debian
- .fdo.distribution-image@debian
check:
extends: .debian_img
stage: "lint"
variables:
RUSTFLAGS: "-D warnings"
script:
- rustc --version
- cargo --version
- cargo fmt --all -- --check
- cargo clippy -- -D warnings
- cargo audit
- codespell
check msrv:
extends: .debian_img
stage: "lint"
script:
- rustup override set $MSRV
- cargo check
# This would be nice but some optional deps (e.g `time`) move very fast wrt to MSRV.
#- cargo check --all-features
docs build:
extends: .debian_img
stage: "lint"
variables:
RUSTDOCFLAGS: "-D warnings"
script:
- cargo doc
.cargo_test_var: &cargo_test
- rustc --version
- cargo --version
- mkdir -p /run/user/$UID
- sed -e s/UID/$UID/ -e s/PATH/path/ CI/dbus-session.conf > /tmp/dbus-session.conf
- sed -e s/UID/$UID/ -e s/PATH/abstract/ CI/dbus-session.conf > /tmp/dbus-session-abstract.conf
- dbus-run-session --config-file /tmp/dbus-session-abstract.conf -- cargo test --verbose -- basic_connection
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose --all-features -- --skip fdpass_systemd
# check cookie-sha1 auth against dbus-daemon
- sed -i s/EXTERNAL/DBUS_COOKIE_SHA1/g /tmp/dbus-session.conf
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose -- basic_connection
# Test tokio support.
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose --tests -p zbus --no-default-features --features tokio -- --skip fdpass_systemd
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose --doc --no-default-features connection::Connection::executor
test:
extends: .debian_img
stage: test
variables:
RUSTFLAGS: "-D warnings"
script:
- rustup override set stable
- *cargo_test
nightly:
extends: .debian_img
stage: test
allow_failure: true
variables:
RUSTFLAGS: "-D warnings"
script:
- rustup override set nightly
- *cargo_test
msvc:
image: $WINDOWS_IMAGE
stage: test
tags:
- "docker"
- "windows"
- "2022"
needs:
- "windows amd64 docker"
variables:
ErrorActionPreference: "Stop"
WarningPreference: "Stop"
PKG_CONFIG_PATH: "C:/lib/pkgconfig"
DBUS_SESSION_BUS_ADDRESS: "tcp:host=127.0.0.1,port=9876"
TRYBUILD: "overwrite" # ignore ui tests
timeout: "45min"
script:
- $env:PATH += ";C:\bin"
- Start-Process dbus-daemon.exe --config-file=CI/win32-session.conf
- cargo test
- $env:DBUS_SESSION_BUS_ADDRESS = $null
- $env:ZBUS_GDBUS_TEST = "1"
# This is an undocumented implementation detail, but easier and faster than calling the gdbus C library
- Start-Process gdbus.exe _win32_run_session_bus
# The gdbus process above will exit when idle for more than three seconds, usually right in the middle
# of the doc tests. This process will keep it alive.
- Start-Process gdbus.exe 'monitor -e -d org.freedesktop.DBus'
- cargo test --package zbus --features windows-gdbus
zvariant_fuzz:
extends: .debian_img
stage: test
script:
- rustup override set nightly
- cargo fuzz run --fuzz-dir zvariant/fuzz dbus -- -max_total_time=30 -max_len=100M
- cargo fuzz run --fuzz-dir zvariant/fuzz gvariant -- -max_total_time=30 -max_len=100M
coverage:
extends: .debian_img
stage: extras
variables:
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "zbus-%p-%m.profraw"
script:
- rustup override set nightly
- *cargo_test
# generate html report
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*cargo*" -o ./coverage/
# generate cobertura report for gitlab integration
- 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
# output coverage summary for gitlab parsing
- lcov -l coverage.lcov
- lcov --summary coverage.lcov
when: manual
artifacts:
paths:
- "coverage"
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
crosscheck:
extends: .debian_img
stage: crosscheck
script:
- cargo check --target x86_64-apple-darwin
- cargo check --target x86_64-unknown-freebsd
- cargo check --target x86_64-unknown-netbsd
- cargo check --target x86_64-pc-windows-gnu
pages:
image: "hrektts/mdbook"
stage: pages
before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- mdbook --version || cargo install --debug mdbook
script:
- mkdir -p public/1.0
- mdbook build book
- mdbook build book-1.0
- cp -r ./book/book/* ./public
- cp -r ./book-1.0/book/* ./public/1.0/
- find $PWD/public | grep "\.html\$"
artifacts:
paths:
- public
only:
refs:
- tags
changes:
- book/**/*