name: Format, Lint, Test

on:
  pull_request:
    branches:
      - main
      - next
      - beta
      - alpha

jobs:
  build:
    runs-on: ubuntu-latest

    services:
      eventsourcingdb:
        image: thenativeweb/eventsourcingdb
        options: >-
          run
          --api-token=secret
          --data-directory-temporary
          --http-enabled
          --https-enabled=false

    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - name: Format
        run: cargo fmt --all -- --check

      - name: Lint
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Test
        run: cargo test --workspace -- --test-threads=1
