name: GPU tests Workflow on: push: branches: ["main", "release/*", "develop", "feat/*"] pull_request: types: [opened, synchronize, reopened, ready_for_review] permissions: contents: read defaults: run: shell: bash env: PYTHON_VERSION: "3.12" # UV_TORCH_BACKEND only works with 'uv pip' commands, not 'uv sync'. # Set to "auto" for GPU workflow (auto-detects CUDA version). UV_TORCH_BACKEND: "auto" concurrency: group: pytest-gpu-test-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: run-gpu-tests: name: Testing if: github.event_name == 'push' || !github.event.pull_request.draft timeout-minutes: 35 runs-on: Roboflow-GPU-VM-Runner steps: - name: ๐Ÿ–ฅ๏ธ Print GPU information run: nvidia-smi - name: ๐Ÿงฐ Install build tools run: | sudo apt-get update sudo apt-get install -y cmake - name: ๐Ÿ“ฅ Checkout the repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: ๐Ÿ Install uv and set Python version uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 with: python-version: ${{ env.PYTHON_VERSION }} activate-environment: true - name: ๐Ÿš€ Install Packages timeout-minutes: 5 # Use uv pip install (not uv sync) to avoid universal lock resolution failing on # extras that require Python>=3.12 (e.g. tflite/onnx2tf) when project supports >=3.10. # UV_TORCH_BACKEND=auto (set above) works only with uv pip, not uv sync. run: uv pip install -e ".[onnx,plus,train,visual]" --group tests --group ci-gpu-pin - name: ๐Ÿงช Run the Test run: | uv run --no-sync pytest tests/ \ -m gpu \ -n 3 \ --reruns 1 --only-rerun "OutOfMemoryError" \ --cov=rfdetr --cov-report=xml \ --timeout=600 \ --durations=20 - name: Upload coverage to Codecov uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: "coverage.xml" flags: gpu,${{ runner.os }},py${{ env.PYTHON_VERSION }} env_vars: OS,PYTHON name: codecov-umbrella fail_ci_if_error: false - name: Minimize uv cache run: uv cache prune --ci