From a8b72631ce8ca1d7ce313dbb59ef9d7f8967b910 Mon Sep 17 00:00:00 2001 From: Prince Karikari Date: Wed, 28 Oct 2026 21:46:11 -0500 Subject: [PATCH] Issue #252 solved: build and test the Rust crates in CI Nothing in CI touched the Rust side. meson-build.yml builds the C++ plugin on Windows with its test step commented out, and super-linter lints YAML and clang-format. So relay, src/server and baton had no automated coverage at all, which is how main came to be failing two relay tests without anyone noticing (#251). Add a workflow that builds and tests all three crates on pull requests and on pushes to main, as a matrix so each crate reports separately, with fail-fast off so one failure does not hide the others. The relay needs wayland, x11, drm and fontconfig headers because of its iced dependency tree, installed only for that crate. No toolchain is named: rust-toolchain.toml at the repository root decides, once #243 lands. Cargo registry and target output are cached per crate, keyed on each Cargo.lock. --- .github/workflows/rust.yml | 83 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..9bbff48 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,83 @@ +--- +name: Rust + +# Builds and tests the Rust crates. The Meson workflow covers the C++ +# plugin only, so without this nothing checks the relay, the mock server +# or baton. + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-and-test: + name: ${{ matrix.crate }} + runs-on: ubuntu-latest + + strategy: + # Report every crate, rather than hiding the rest behind the + # first failure. + fail-fast: false + matrix: + crate: + - relay + - src/server + - xplane_plugin/subprojects/baton + + steps: + - uses: actions/checkout@v4 + + # The relay is an iced GUI, so its dependency tree pulls in + # wayland, x11 and drm crates that need these headers present to + # build. The other two crates are plain std and need none of it. + - name: Install GUI build dependencies + if: matrix.crate == 'relay' + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + libwayland-dev \ + libxkbcommon-dev \ + libx11-dev \ + libxcursor-dev \ + libxi-dev \ + libxrandr-dev \ + libgl1-mesa-dev \ + libudev-dev \ + libfontconfig1-dev \ + pkg-config + + # rust-toolchain.toml at the repository root decides the version, + # so no toolchain is named here. + - name: Show toolchain + run: | + rustc --version + cargo --version + + - name: Cache cargo registry and build output + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ${{ matrix.crate }}/target + key: >- + ${{ runner.os }}-cargo-${{ matrix.crate }}-${{ + hashFiles(format('{0}/Cargo.lock', matrix.crate)) }} + restore-keys: | + ${{ runner.os }}-cargo-${{ matrix.crate }}- + + - name: Build + working-directory: ${{ matrix.crate }} + run: cargo build --verbose + + - name: Test + working-directory: ${{ matrix.crate }} + run: cargo test --verbose