Files
yaak-mountain-loop/.github/workflows/ci-rust.yml
2024-06-07 11:57:44 -07:00

55 lines
1.3 KiB
YAML

on:
push:
paths:
- src-tauri/**
- .github/workflows/**
name: CI (Rust)
defaults:
run:
working-directory: src-tauri
jobs:
test:
name: Check/Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'src-tauri'
sparse-checkout-cone-mode: false
- run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # required for `cargo udeps`
override: true
components: rustfmt, clippy
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Lint
run: |
cargo fmt --all -- --check
cargo clippy -- -D warnings
- run: cargo install --locked cargo-udeps || true
- name: Check
run: |
cargo udeps
rm -rf ~/.cargo/advisory-db
- name: Test
run: cargo test --all