name: CI
on:
push:
branches: [main, master]
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: linux-stable-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- run: |
sudo apt-get update
sudo apt-get install -y \
libudev-dev \
gcc g++ clang libfontconfig-dev libwayland-dev \
libxkbcommon-x11-dev libx11-xcb-dev \
libssl-dev libzstd-dev pkg-config
- run: cargo clippy --workspace --all-targets -- -D warnings
msrv:
name: MSRV (cargo check, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.96
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: msrv-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libudev-dev \
gcc g++ clang libfontconfig-dev libwayland-dev \
libxkbcommon-x11-dev libx11-xcb-dev \
libssl-dev libzstd-dev pkg-config
- run: cargo check --workspace --all-targets
docs-hid:
name: rustdoc (hid crates)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: linux-stable-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- run: |
sudo apt-get update
sudo apt-get install -y \
libudev-dev \
pkg-config
- name: cargo doc (openlogi-hid)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p openlogi-hid --no-deps --document-private-items
- name: cargo doc (openlogi-hidpp)
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc -p openlogi-hidpp --no-deps --document-private-items
test-linux:
name: tests (linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: linux-stable-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- run: |
sudo apt-get update
sudo apt-get install -y \
libudev-dev \
gcc g++ clang libfontconfig-dev libwayland-dev \
libxkbcommon-x11-dev libx11-xcb-dev \
libssl-dev libzstd-dev pkg-config
- run: cargo test --workspace --exclude openlogi-gui
test-macos:
name: tests (macos, ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: macos-latest
- arch: x86_64
runner: macos-15-intel
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: macos-stable-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- name: Verify runner architecture
run: test "$(uname -m)" = "${{ matrix.arch }}"
- run: cargo test --workspace --all-targets
cargo-deny:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny
- run: cargo deny --all-features check
clippy-windows:
name: clippy (windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: windows-stable-debug
save-if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
- run: cargo clippy --workspace --all-targets -- -D warnings