Files
qitech-control/.github/workflows/rust.yml
T

52 lines
1.2 KiB
YAML

name: Rust
on:
push:
branches:
- "**"
pull_request:
branches: "*"
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "1.86"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install libudev development package
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- uses: actions/checkout@v4
- name: Set Rust version
run: rustup override set ${{ env.RUST_VERSION }}
- name: Install Formatter
run: rustup component add rustfmt
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ env.RUST_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.RUST_VERSION }}-cargo-
- name: Build
env:
RUSTFLAGS: "-D warnings"
run: cargo build --verbose
- name: Format
run: cargo fmt --check --verbose
- name: Run tests
run: cargo test --verbose
- name: Mock Machine
run: cargo build --features development-build --features mock-machine