name: CodSpeed

on:
  push:
    branches:
      - "main"
  pull_request:
    branches:
      - "main"

permissions: {}

jobs:
  benchmarks:
    name: Run benchmarks
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the repository
        uses: actions/checkout@v4.2.2

      - name: 🛠 Set up Python 3
        uses: actions/setup-python@v5.6.0
        id: python
        with:
          python-version: 3.x

      - name: Install uv
        uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc  # v6.4.3
        with:
          version: "0.7.19"

      - name: Install dependencies
        run: script/bootstrap

      - name: Run benchmarks
        uses: CodSpeedHQ/action@0b6e7a3d96c9d2a6057e7bcea6b45aaf2f7ce60b  # v3.8.0
        with:
          token: ${{ secrets.CODSPEED_TOKEN }}
          run: uv run --dev pytest -x --no-cov -vvvvv --codspeed benchmarks
