forked from dbus2/zbus-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
167 lines (152 loc) · 4.67 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
.templates_sha: &templates_sha 79c325922670137e8f0a4dc5f6f097e0eb57c1af
include:
- project: 'freedesktop/ci-templates'
ref: *templates_sha
file: '/templates/debian.yml'
variables:
FDO_UPSTREAM_REPO: dbus/zbus
stages:
- container
- lint
- test
- extras
- crosscheck
- pages
.debian:
variables:
# Update this tag when you want to trigger a rebuild
FDO_DISTRIBUTION_TAG: '2021-07-29.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
FDO_DISTRIBUTION_EXEC: >-
gitlab/install-rust.sh stable &&
pip3 install lcov_cobertura &&
pip3 install codespell
before_script:
- source ./gitlab/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
.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 -Aclippy::upper_case_acronyms
- cargo audit
- codespell
.cargo_test_var: &cargo_test
- rustc --version
- cargo --version
- mkdir -p /run/user/$UID
- sed -e s/UID/$UID/ -e s/PATH/path/ gitlab/dbus-session.conf > /tmp/dbus-session.conf
- sed -e s/UID/$UID/ -e s/PATH/abstract/ gitlab/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 external executor (currently only 2 tests can handle it so only run those)
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose --package zbus --no-default-features fdo::tests::signal_stream
- dbus-run-session --config-file /tmp/dbus-session.conf -- cargo test --verbose --doc --no-default-features azync::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
- cargo fmt --all -- --check
- cargo clippy --tests -- -D warnings -Aclippy::upper_case_acronyms
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:
cobertura: 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
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/**/*