Skip to content

Add GitHub Actions workflows for building, testing, and publishing to… #1

Add GitHub Actions workflows for building, testing, and publishing to…

Add GitHub Actions workflows for building, testing, and publishing to… #1

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libhidapi-dev libudev-dev pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: risemode-driver-linux-x86_64
path: target/release/risemode-driver