Skip to content

Merge pull request #1046 from zeenix/drop-deps #7

Merge pull request #1046 from zeenix/drop-deps

Merge pull request #1046 from zeenix/drop-deps #7

Workflow file for this run

name: Lint, Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
fmt:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
# We use some nightly fmt options.
toolchain: nightly
components: rustfmt
targets: x86_64-apple-darwin, x86_64-unknown-freebsd, x86_64-unknown-netbsd x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: |
cargo --locked fmt -- --check
cargo --locked check --target x86_64-apple-darwin
cargo --locked check --target x86_64-unknown-freebsd
cargo --locked check --target x86_64-unknown-netbsd
cargo --locked check --target x86_64-pc-windows-gnu
clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
targets: x86_64-apple-darwin, x86_64-unknown-freebsd, x86_64-unknown-netbsd x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
- name: Catch common mistakes and unwrap calls
run: |
cargo --locked clippy
cargo --locked clippy --target x86_64-apple-darwin
cargo --locked clippy --target x86_64-unknown-freebsd
cargo --locked clippy --target x86_64-unknown-netbsd
cargo --locked clippy --target x86_64-pc-windows-gnu
linux_test:
runs-on: ubuntu-latest
needs: [fmt, clippy]
strategy:
matrix:
# Test in both debug and release mode
env:
- PROFILE: dev
- PROFILE: release
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
PROFILE: ${{ matrix.env.PROFILE }}
steps:
- uses: actions/checkout@v4
- 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: |
dbus-run-session --config-file /tmp/dbus-session-abstract.conf -- cargo --locked test --profile "$PROFILE" --verbose -- basic_connection
# All features except tokio.
dbus-run-session --config-file /tmp/dbus-session.conf -- \
cargo --locked test --profile "$PROFILE" --verbose --features uuid,url,time,chrono,option-as-array,vsock,bus-impl \
-- --skip fdpass_systemd
# Test tokio support.
dbus-run-session --config-file /tmp/dbus-session.conf -- \
cargo --locked test --profile "$PROFILE" --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 --profile "$PROFILE" --verbose --doc --no-default-features connection::Connection::executor
# zvariant only with ostree tests (which implicitly enables `gvariant` feature too).
cargo --locked t -p zvariant --features ostree-tests
windows_test:
runs-on: windows-latest
needs: [fmt, clippy]
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
PKG_CONFIG: C:\bin\pkg-config.exe
PKG_CONFIG_PATH: C:\lib\pkgconfig
steps:
- uses: actions/checkout@v4
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v4
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 --address=autolaunch:'
cargo --locked test
# tokio feature
cargo --locked test --no-default-features --features tokio
# zvariant only with ostree tests (which implicitly enables `gvariant` feature too).
cargo --locked t -p zvariant --features ostree-tests
zvariant_fuzz:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v4
- 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 --features gvariant gvariant -- -max_total_time=30 -max_len=100M
doc_build:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Check documentation build
run: cargo --locked doc --all-features