hid-io-core 0.1.4

HID-IO is a host-side daemon for advanced HID devices.
Documentation
name: Rust Linux

on: [push, pull_request]

env:
  deb_packages: >-
    capnproto
    libclang-dev
    libevdev-dev
    libudev-dev
    libwayland-dev
    libxcb-xkb-dev
    libxkbcommon-dev
    libxkbcommon-x11-dev
    libxtst-dev
    llvm
    ninja-build
  mingw_w64_packages: >-
    mingw-w64
    wine-stable
    wine-binfmt

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
      - name: Cargo Check
        run: cargo check --all

  test:
    name: Test Suite
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.7]
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
          python -m pip install --upgrade pip
      - name: Cargo Test
        run: cargo test --all
      - name: Lint with flake8
        working-directory: ./python
        run: |
          python -m pip install flake8
          flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
          flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
      - name: Install pycapnp dependencies and run test
        working-directory: ./python
        run: |
          python -m pip install cython
          CXXFLAGS=-fPIC CFLAGS=-fPIC python -m pip install -r requirements.txt
          python -m pytest -vvv

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
      - name: Cargo Build
        run: cargo build --all
      - name: Cargo Install
        run: cargo install --path . --bins --examples --root dist
      - uses: actions/upload-artifact@v1.0.0
        with:
          name: linux_release_binaries
          path: dist/bin

  lib_build:
    name: Lib Build (hidapi)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
      - name: Cargo Build
        run: cargo build --no-default-features --features "hidapi-devices"

  mingw_w64build:
    name: mingw-w64 Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
        with:
          targets: x86_64-pc-windows-gnu
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
          sudo apt-get install -y ${{ env.mingw_w64_packages }}
      - name: Cargo Test
        run: cargo test --no-run --all --target x86_64-pc-windows-gnu

  hid-io-protocol_builddevice:
    name: hid-io-protocol Device Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
      - name: Cargo Build
        run: cargo build --manifest-path hid-io-protocol/Cargo.toml --no-default-features --features device --release

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - name: Rustfmt Check
        uses: actions-rust-lang/rustfmt@v1

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: clippy
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
      - name: Cargo Clippy
        run: cargo clippy --all-targets -- -D warnings

  udeps:
    name: cargo-udeps
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: dtolnay/rust-toolchain@nightly
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ env.deb_packages }}
      - name: cargo-binstall
        run: |
          mkdir -p ~/.cargo/bin
          wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
          tar xf cargo-binstall*.tgz -C ~/.cargo/bin
      - run: cargo binstall --no-confirm cargo-udeps
      - name: Cargo Udeps
        run: cargo udeps --all-targets