name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  RUSTFLAGS: "-Dwarnings"

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Ensure latest Rust stable
        run: |
          rustup update stable
          rustup default stable

      - name: Run tests
        env:
          MIHI_DATABASE: test.sqlite3
        run: |
          mkdir -p $HOME/.config/mihi
          cp testdata/test.sqlite3 $HOME/.config/mihi/
          cargo test --verbose

      - name: Run Clippy
        run: cargo clippy --all-targets --all-features
