Skip to content

⬆️ zb: Swtich to new smol-rs crates #407

⬆️ zb: Swtich to new smol-rs crates

⬆️ zb: Swtich to new smol-rs crates #407

Workflow file for this run

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