-
-
Notifications
You must be signed in to change notification settings - Fork 94
250 lines (233 loc) · 8.66 KB
/
rust.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
name: Lint, Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
MSRV:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
MSRV: 1.66.0
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
targets: x86_64-pc-windows-gnu, x86_64-apple-darwin, x86_64-unknown-freebsd, x86_64-unknown-netbsd
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check build with MSRV
run: |
cargo check
cargo check --target x86_64-pc-windows-gnu
cargo check --target x86_64-apple-darwin
cargo check --target x86_64-unknown-freebsd
cargo check --target x86_64-unknown-netbsd
# This would be nice but some optional deps (e.g `time`) move very fast wrt to MSRV.
# cargo check --all-features
lint:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt -- --check
- name: Catch common mistakes and unwrap calls
run: cargo clippy -- -D warnings -D clippy::large_futures
linux_test:
runs-on: ubuntu-latest
needs: lint
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v3
- name: Setup
run: |
sudo 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
sudo apt-get install -y dbus
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build and Test
run: |
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
windows_test:
runs-on: windows-latest
needs: lint
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
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
steps:
- uses: actions/checkout@v3
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: |
c:/share/*dbus*
c:/lib/libexpat.lib
c:/bin/libexpat.dll
c:/bin/xmlwf.exe
c:/bin/*dbus*
c:/lib/*dbus*
c:/var/lib/*dbus*
c:/lib/*glib*
c:/lib/*gio*
c:/lib/*gobject*
c:/lib/*gmodule*
c:/lib/*gthread*
c:/lib/*gspawn*
c:/lib/*gresource*
c:/lib/*pcre*
c:/lib/*z*
c:/lib/*ffi*
c:/lib/*intl*
c:/lib/*pkgconfig*
c:/bin/*glib*
c:/bin/*gio*
c:/bin/*gobject*
c:/bin/*gmodule*
c:/bin/*gthread*
c:/bin/*gspawn*
c:/bin/*gresource*
c:/bin/*pcre*
c:/bin/*z*
c:/bin/*ffi*
c:/bin/*intl*
key: ${{ runner.os }}-cache
- name: Install pkg-config
shell: pwsh
run: |
# This is needed for some reason: https://github.com/dbus2/zbus/actions/runs/4917893488/jobs/8783555606
choco feature enable -n allowEmptyChecksums
choco install -y pkgconfiglite
- name: Install Meson
if: steps.cache-deps.outputs.cache-hit != 'true'
shell: pwsh
run: pip3 install meson
- name: Setup MSVC Environment
if: steps.cache-deps.outputs.cache-hit != 'true'
uses: ilammy/msvc-dev-cmd@v1
- name: Build & Install GLib
if: steps.cache-deps.outputs.cache-hit != 'true'
shell: pwsh
run: |
(New-Object System.Net.WebClient).DownloadString('https://wrapdb.mesonbuild.com/v2/pcre_8.37-2/get_patch') >$null
(New-Object System.Net.WebClient).DownloadString('https://zlib.net/fossils/') >$null
git clone --depth 1 --branch 2.74.1 https://gitlab.gnome.org/GNOME/glib.git \glib
cd -Path \glib
meson setup builddir
meson compile -C builddir
meson install --no-rebuild -C builddir
- name: Build & Install libexpat
if: steps.cache-deps.outputs.cache-hit != 'true'
shell: pwsh
run: |
# Upstream expat doesn't ship devel? let's build it then...
git clone --depth 1 --branch R_2_4_2 https://github.com/libexpat/libexpat \libexpat
cd -Path \libexpat\expat
cmake --install-prefix c:/ -G "Visual Studio 17 2022" -A x64 .
cmake --build . --config Release
cmake --install . --config Release
- name: Build & Install dbus daemon
if: steps.cache-deps.outputs.cache-hit != 'true'
shell: pwsh
run: |
git clone --depth 1 https://gitlab.freedesktop.org/dbus/dbus.git \dbus
cd -Path \dbus
cmake --install-prefix c:/ -DCMAKE_PREFIX_PATH=C:/ -DDBUS_ENABLE_XML_DOCS=OFF -DDBUS_ENABLE_DOXYGEN_DOCS=OFF -G "NMake Makefiles" .
nmake
nmake install
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build and Test
shell: pwsh
run: |
$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 --features zbus/windows-gdbus
cross_check:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-apple-darwin, x86_64-unknown-freebsd, x86_64-unknown-netbsd
- uses: Swatinem/rust-cache@v2
- name: Check portability
run: |
cargo check --target x86_64-apple-darwin
cargo check --target x86_64-unknown-freebsd
cargo check --target x86_64-unknown-netbsd
zvariant_fuzz:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
- name: Fuzz zvariant
run: |
cargo install cargo-fuzz
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
doc_build:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Check documentation build
run: cargo doc