name: Slow end to end tests

on:
  push:
    branches:
      - main
      - v*-release
  pull_request:
    branches:
      - main

permissions: {}

jobs:
  run_tests:
    permissions:
      contents: read
    name: Run tests
    runs-on: 'aws-g4dn-2xlarge-use1-public-80'
    container:
      # Ships torch, Python 3.12 and the CUDA toolkit (nvcc, CUDA_HOME). Keep the torch
      # version in sync with the one pinned by the latest vllm so it is not reinstalled.
      image: pytorch/pytorch:2.13.0-cuda13.0-cudnn9-devel
      options: --gpus all --shm-size 16g
    defaults:
      run:
        shell: bash
    steps:
      - name: Install Git and Git LFS
        run: |
          apt-get update && apt-get install -y git git-lfs && git lfs install
          # The workspace is mounted from the host with a different owner
          git config --global --add safe.directory "$GITHUB_WORKSPACE"

      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          lfs: true

      - name: Install uv
        uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86  # v5.4.2
        with:
          enable-cache: true

      - name: Install the project
        # Install into the image's Python so the preinstalled torch is reused
        run: uv pip install --system --break-system-packages -e ".[dev-gpu]"

      - name: run nvidia-smi
        run: nvidia-smi

      - name: Run tests
        run: python -m pytest --disable-pytest-warnings --runslow -v -s tests/slow_tests/
