name: Benchmark Repro

on:
  pull_request:
    paths:
      - ".github/workflows/benchmark-repro.yml"
      - "benchmarks/**"
      - "pyproject.toml"
      - "uv.lock"
      - "scripts/check_finished_benchmark_repro.py"
      - "scripts/validate_benchmark_contract.py"
      - "tests/benchmarks/**"
  push:
    branches:
      - main
    paths:
      - ".github/workflows/benchmark-repro.yml"
      - "benchmarks/**"
      - "pyproject.toml"
      - "uv.lock"
      - "scripts/check_finished_benchmark_repro.py"
      - "scripts/validate_benchmark_contract.py"
      - "tests/benchmarks/**"
  workflow_dispatch:

jobs:
  repro:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - uses: astral-sh/setup-uv@v7

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.13.11"

      - name: Sync environment
        run: uv sync

      - name: Check finished benchmark reproducibility
        run: uv run python scripts/check_finished_benchmark_repro.py
