wdotool 0.1.6

xdotool-compatible automation for Wayland
name: CI

on:
  push:
    branches: [main]
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  check:
    name: fmt + clippy + test
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4

      - name: Install system deps
        # wdotool links against libxkbcommon and libwayland at build time.
        run: |
          sudo apt-get update
          sudo apt-get install -y libxkbcommon-dev libwayland-dev

      - name: Install Rust toolchain
        # rustup is already preinstalled on ubuntu-22.04; pin components.
        run: rustup show && rustup component add rustfmt clippy

      - name: Cache cargo registry + target
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-

      - name: cargo fmt --check
        run: cargo fmt --all -- --check

      - name: cargo clippy
        # -D warnings turns clippy findings into errors so regressions show up
        # as a red CI. Remove individual lints with #[allow] at the use site,
        # not by weakening this flag.
        run: cargo clippy --all-targets -- -D warnings

      - name: cargo test
        run: cargo test --all-targets --locked

  # TODO(integration): boot wdotool under a headless wlroots compositor.
  # First attempt used `cage` from Ubuntu 22.04 (0.1.4), which exited code
  # 1 with no output under WLR_BACKENDS=headless on a GitHub runner — not
  # enough signal to diagnose cheaply. Alternatives to explore later:
  #   - labwc with -C /dev/null and WLR_BACKENDS=headless
  #   - sway --headless with a minimal config
  #   - a purpose-built test harness that binds the wlr protocols as
  #     a server (mocks the compositor side, asserts our requests)