Merge pull request #604 from dbus2/renovate/async-task-4.x #757
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.75.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 --locked check | |
cargo --locked check --target x86_64-pc-windows-gnu | |
cargo --locked check --target x86_64-apple-darwin | |
cargo --locked check --target x86_64-unknown-freebsd | |
cargo --locked check --target x86_64-unknown-netbsd | |
# This would be nice but some optional deps (e.g `time`) move very fast wrt to MSRV. | |
# cargo --locked 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: nightly | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo --locked fmt -- --check | |
- name: Catch common mistakes and unwrap calls | |
run: cargo --locked 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 --locked test --verbose -- basic_connection | |
# All features except tokio. | |
dbus-run-session --config-file /tmp/dbus-session.conf -- \ | |
cargo --locked test --verbose --features uuid,url,time,chrono,option-as-array,vsock,bus-impl \ | |
-- --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 --locked test --verbose -- basic_connection | |
# Test tokio support. | |
dbus-run-session --config-file /tmp/dbus-session.conf -- \ | |
cargo --locked test --verbose --tests -p zbus --no-default-features \ | |
--features tokio-vsock -- --skip fdpass_systemd | |
dbus-run-session --config-file /tmp/dbus-session.conf -- \ | |
cargo --locked 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 | |
PKG_CONFIG: C:\bin\pkg-config.exe | |
PKG_CONFIG_PATH: C:\lib\pkgconfig | |
DBUS_SESSION_BUS_ADDRESS: tcp:host=127.0.0.1,port=9876 | |
ZBUS_GDBUS_TEST: 1 | |
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:/bin/*pkg-config* | |
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 Meson and Ninja | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: pip3 install meson ninja | |
- name: Install pkg-config | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
git clone --branch meson-glib-subproject --depth 1 https://gitlab.freedesktop.org/tpm/pkg-config.git | |
cd pkg-config | |
meson build -Dprefix=C:\ --buildtype release | |
ninja -C build | |
ninja -C build install | |
- 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' | |
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' | |
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' | |
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: Test | |
run: | | |
$env:PATH += ";C:\bin" | |
Start-Process dbus-daemon.exe --config-file=CI/win32-session.conf | |
cargo --locked test | |
# tokio feature | |
cargo --locked test --no-default-features --features tokio | |
- name: Test gdbus feature | |
run: | | |
$env:DBUS_SESSION_BUS_ADDRESS = $null | |
$env:PATH += ";C:\bin" | |
# 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 --locked 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 --locked check --target x86_64-apple-darwin | |
cargo --locked check --target x86_64-unknown-freebsd | |
cargo --locked 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 --locked install cargo-fuzz | |
cargo --locked fuzz run --fuzz-dir zvariant/fuzz dbus -- -max_total_time=30 -max_len=100M | |
cargo --locked 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 --locked doc --all-features |