on:
  pull_request:
    branches: [develop]
    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
      - run: |
          sudo apt-get update
          sudo apt-get install -y libwebkit2gtk-4.1-dev
      - uses: dtolnay/rust-toolchain@stable
      - 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-
      - run: cargo check --all
      - run: cargo test --all
