name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update APT and install libudev-dev
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Extract Rust version from Cargo.toml
run: |
MSRV=$(sed -n 's/^rust-version = "\([^"]*\)"/\1/p' Cargo.toml)
echo "rust-version: $MSRV"
echo "MSRV=$MSRV" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable with:
toolchain: ${{ env.MSRV }}
- name: Install and run rustfmt
run: |
rustup component add rustfmt
cargo fmt
- name: Install and run clippy
run: |
rustup component add clippy
cargo clippy
- name: Run tests
run: cargo test --all-features -- --nocapture
- name: Build
run: cargo build --all-features --verbose