Skip to content

Merge pull request #150 from JohannesSchilling/hiddevice-as-raw-fd #183

Merge pull request #150 from JohannesSchilling/hiddevice-as-raw-fd

Merge pull request #150 from JohannesSchilling/hiddevice-as-raw-fd #183

Workflow file for this run

name: Rust
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false # don't give up on the whole matrix if one variant fails
matrix:
linkage:
- static
- shared
library:
- hidraw
- libusb
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y cmake libudev-dev libumockdev-dev umockdev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build libusb
run: |
git clone https://github.com/libusb/libusb.git ./etc/libusb/
cd ./etc/libusb/
./autogen.sh
make
sudo make install
cd -
rm -rf ./etc/libusb/
- name: Build hidapi
run: |
cd ./etc/hidapi/
mkdir ./build/
cd ./build/
cmake ..
make
sudo make install
- name: List pkgconfig definitions
run: grep -RHn ^ /usr/local/lib/pkgconfig
- name: Build
run: cargo build --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
- name: Run tests
run: cargo test --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
- name: Verify package
run: |
cargo package --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
build-linux-native:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libudev-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --no-default-features --features linux-native --verbose
- name: Run tests
run: cargo test --no-default-features --features linux-native --verbose
- name: Verify package
run: cargo package --no-default-features --features linux-native --verbose
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --no-default-features --verbose
- name: Run tests
run: cargo test --no-default-features --verbose
- name: Verify package
run: cargo package --no-default-features --verbose
build-windows-native:
runs-on: windows-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --no-default-features --features windows-native --verbose
- name: Run tests
run: cargo test --no-default-features --features windows-native --verbose
- name: Verify package
run: cargo package --no-default-features --features windows-native --verbose
build-macos:
runs-on: macos-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --no-default-features --verbose
- name: Run tests
run: cargo test --no-default-features --verbose
- name: Verify package
run: cargo package --no-default-features --verbose
fmt-check:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check code formatting
run: cargo fmt --check