wlproxy 0.2.2

Filter/modify Wayland messages from clients
Documentation
name: Test

on:
  workflow_dispatch:
  push:
    branches: [main]
  pull_request:
    branches: [main]

# Cancel testing of a previous commit for the same branch.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: write # To update gh-badges branch.

jobs:
  main:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v6

      - uses: jdx/mise-action@v4
      - run: git reset --hard # Work around https://github.com/jdx/mise/discussions/8270.

      - run: rustup component add clippy rustfmt

      - uses: Swatinem/rust-cache@v2

      - run: mise run ci

      # Run tests with coverage (on main only) for the badge below.
      - run: mise run cover:rust
        if: github.ref_name == 'main'

      - uses: powerman/.github/.github/actions/coverage-badge@main
        if: github.ref_name == 'main'
        with:
          total_cmd: "mise run -q cover:rust:total"

  # Testing on available native platforms.
  native:
    strategy:
      matrix:
        include:
          - {os: ubuntu-24.04-arm} # Linux ARM64
          - {os: macos-15-intel} # macOS AMD64
          - {os: macos-latest} # macOS ARM64
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v6

      - uses: jdx/mise-action@v4
        with:
          install_args: rust
      - run: git reset --hard # Work around https://github.com/jdx/mise/discussions/8270.

      - run: rustup component add clippy rustfmt

      - uses: Swatinem/rust-cache@v2

      - run: cargo test --workspace

  # Aggregate job for branch protection.
  test:
    needs: [main, native]
    runs-on: ubuntu-latest
    if: always()
    steps:
      - name: Fail if any dependency failed, cancelled or skipped
        if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
        run: exit 1