name: vLLM Main Branch Tests

on:
  schedule:
    - cron: '0 2 * * 1'  # Every Monday at 2 AM UTC
  workflow_dispatch:


permissions: {}

jobs:
  test_vllm_main:
    permissions:
      contents: read
    name: Test with vLLM main branch
    runs-on: 'aws-g4dn-2xlarge-use1-public-80'
    continue-on-error: true
    container:
      # Nightly build of vllm main, so vllm does not have to be compiled from source.
      # cu129 is supported by the runner's driver (580, CUDA 13.0).
      image: vllm/vllm-openai:cu129-nightly-x86_64
      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@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          lfs: true

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

      - name: Install the project
        # Skip the vllm extra so the image's vllm build is kept
        run: uv pip install --system --break-system-packages -e ".[dev,multilingual,math,extended_tasks]" ray more_itertools

      - name: Verify CUDA
        run: nvidia-smi

      - name: Get vLLM version
        id: vllm-info
        run: |
          VERSION=$(python3 -c "import vllm; print(vllm.__version__)")
          echo "version=$VERSION" >> $GITHUB_OUTPUT
          echo "Testing vLLM version: $VERSION"

      - name: Run tests
        run: python3 -m pytest --disable-pytest-warnings --runslow -v -s tests/slow_tests/test_vllm_model.py
