chore: import upstream snapshot with attribution
CPU tests Workflow / Testing (ubuntu-latest, 3.12) (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.13) (push) Failing after 0s
Mypy Type Check / Type Check (push) Failing after 0s
Docs/Test WorkFlow / Test docs build (push) Failing after 1s
PR Conflict Labeler / labeling (push) Failing after 1s
Dependency resolution / Resolve [tflite] extra — Python 3.12 (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.10) (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.13) (push) Failing after 1s
CPU tests Workflow / build-pkg (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.10) (push) Failing after 0s
CPU tests Workflow / Testing (ubuntu-latest, 3.11) (push) Failing after 0s
Smoke Tests / try-all-models (macos-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (macos-latest, 3.13) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / testing-guardian (push) Has been cancelled
GPU tests Workflow / Testing (push) Has been cancelled
CPU tests Workflow / Testing (ubuntu-latest, 3.12) (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.13) (push) Failing after 0s
Mypy Type Check / Type Check (push) Failing after 0s
Docs/Test WorkFlow / Test docs build (push) Failing after 1s
PR Conflict Labeler / labeling (push) Failing after 1s
Dependency resolution / Resolve [tflite] extra — Python 3.12 (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.10) (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.13) (push) Failing after 1s
CPU tests Workflow / build-pkg (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.10) (push) Failing after 0s
CPU tests Workflow / Testing (ubuntu-latest, 3.11) (push) Failing after 0s
Smoke Tests / try-all-models (macos-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (macos-latest, 3.13) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / testing-guardian (push) Has been cancelled
GPU tests Workflow / Testing (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
name: Build Package
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
required: false
|
||||
type: string
|
||||
default: "3.10"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: 🐍 Install uv and set Python version ${{ inputs.python-version }}
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
activate-environment: true
|
||||
|
||||
- name: 🏗️ Build source and wheel distributions
|
||||
run: |
|
||||
uv pip install --group build
|
||||
uv build
|
||||
uv run --no-sync twine check --strict dist/*
|
||||
|
||||
- name: 📤 Upload distribution artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Docs/Test WorkFlow
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
push:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
workflow_dispatch: {}
|
||||
|
||||
# Restrict permissions by default
|
||||
permissions:
|
||||
contents: read # Required for checkout
|
||||
checks: write # Required for test reporting
|
||||
|
||||
jobs:
|
||||
docs-build-test:
|
||||
name: Test docs build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🐍 Install uv and set Python
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: "3.10"
|
||||
activate-environment: true
|
||||
|
||||
- name: 🏗️ Install dependencies
|
||||
timeout-minutes: 5
|
||||
run: uv pip install -e ".[plus]" --group docs
|
||||
|
||||
- name: 🧪 Test Docs Build
|
||||
run: uv run --no-sync mkdocs build --verbose
|
||||
|
||||
- name: 📤 Upload docs artifact
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: docs-site
|
||||
path: site/
|
||||
retention-days: 7
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Dependency resolution
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
paths: ["pyproject.toml"]
|
||||
pull_request:
|
||||
paths: ["pyproject.toml"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
concurrency:
|
||||
group: deps-resolution-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
tflite-resolution:
|
||||
name: Resolve [tflite] extra — Python ${{ matrix.python-version }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# tflite deps carry python_version>='3.12' and <'3.13' markers; onnx2tf pins numpy==1.26.4
|
||||
# exactly, which conflicts with ml-dtypes>=0.5.1 requiring numpy>=2.1.0 on 3.13.
|
||||
# Add 3.13 and relax the <'3.13' upper bound when onnx2tf drops the exact numpy pin.
|
||||
python-version: ["3.12"]
|
||||
steps:
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: 🔍 Resolve [tflite] optional dependencies
|
||||
run: |
|
||||
uv pip compile pyproject.toml \
|
||||
--extra tflite \
|
||||
--python-version ${{ matrix.python-version }} \
|
||||
--no-header \
|
||||
--quiet
|
||||
|
||||
- name: Minimize uv cache
|
||||
continue-on-error: true
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Smoke Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
pull_request:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# UV_TORCH_BACKEND only works with 'uv pip' commands, not 'uv sync'.
|
||||
# Used by 'uv pip install torch torchvision' step to install CPU-only PyTorch.
|
||||
UV_TORCH_BACKEND: "cpu"
|
||||
|
||||
concurrency:
|
||||
group: model-smoke-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
try-all-models:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
||||
python-version: ["3.10", "3.13"]
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
activate-environment: true
|
||||
|
||||
- name: 🚀 Install Packages (plus extras)
|
||||
timeout-minutes: 5
|
||||
# Install PyTorch CPU-only first (UV_TORCH_BACKEND=cpu works with 'uv pip')
|
||||
run: uv pip install -e .[plus]
|
||||
|
||||
- name: 🔎 Smoke-test model instantiation, downloads, and inference
|
||||
run: python tests/run_smoke_all_models.py
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,99 @@
|
||||
name: CPU tests Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "release/*", "develop", "feat/*"]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
# UV_TORCH_BACKEND only works with 'uv pip' commands, not 'uv sync'.
|
||||
# Used by 'uv pip install torch torchvision' step to install CPU-only PyTorch.
|
||||
UV_TORCH_BACKEND: "cpu"
|
||||
|
||||
concurrency:
|
||||
group: pytest-test-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build-pkg:
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
|
||||
run-tests:
|
||||
name: Testing
|
||||
# needs: build # todo: consider using this build package for testing
|
||||
timeout-minutes: 25
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-latest"]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
include:
|
||||
- { os: "windows-latest", python-version: "3.10" }
|
||||
- { os: "macos-latest", python-version: "3.10" }
|
||||
- { os: "windows-latest", python-version: "3.13" }
|
||||
- { os: "macos-latest", python-version: "3.13" }
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
activate-environment: true
|
||||
|
||||
- name: 🚀 Install Packages
|
||||
timeout-minutes: 5
|
||||
# Install PyTorch CPU-only first (UV_TORCH_BACKEND=cpu works with 'uv pip')
|
||||
run: uv pip install -e ".[train,cli,visual,kornia]" --group tests
|
||||
|
||||
- name: 🧪 Run the Test
|
||||
run: |
|
||||
uv run --no-sync pytest src/ tests/ \
|
||||
-n 2 -m "not gpu and not coco17" \
|
||||
--ignore=tests/run_smoke_all_models.py \
|
||||
--cov=rfdetr --cov-report=xml \
|
||||
--timeout=420 \
|
||||
--durations=50
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: "coverage.xml"
|
||||
flags: cpu,${{ runner.os }},py${{ matrix.python-version }}
|
||||
env_vars: OS,PYTHON
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Minimize uv cache
|
||||
continue-on-error: true
|
||||
run: uv cache prune --ci
|
||||
|
||||
testing-guardian:
|
||||
runs-on: ubuntu-latest
|
||||
needs: run-tests
|
||||
if: always()
|
||||
steps:
|
||||
- name: 📋 Display test result
|
||||
run: echo "${{ needs.run-tests.result }}"
|
||||
- name: ❌ Fail guardian on test failure
|
||||
if: needs.run-tests.result == 'failure'
|
||||
run: exit 1
|
||||
# Ensure that cancelled or skipped test runs still cause this guardian job to fail,
|
||||
# using an explicit exit code instead of relying on timeout behavior.
|
||||
- name: ⚠️ cancelled or skipped...
|
||||
if: contains(fromJSON('["cancelled", "skipped"]'), needs.run-tests.result)
|
||||
run: |
|
||||
echo "run-tests job result is '${{ needs.run-tests.result }}'; failing explicitly."
|
||||
exit 1
|
||||
- name: ✅ tests succeeded
|
||||
if: needs.run-tests.result == 'success'
|
||||
run: echo "All tests completed successfully in job 'run-tests'."
|
||||
@@ -0,0 +1,75 @@
|
||||
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
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Mypy Type Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
# UV_TORCH_BACKEND only works with 'uv pip' commands, not 'uv sync'.
|
||||
# Used by 'uv pip install torch torchvision' step to install CPU-only PyTorch.
|
||||
UV_TORCH_BACKEND: "cpu"
|
||||
|
||||
concurrency:
|
||||
group: mypy-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
type-check:
|
||||
name: Type Check
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- 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: "3.10"
|
||||
activate-environment: true
|
||||
|
||||
- name: 🚀 Install Packages
|
||||
timeout-minutes: 5
|
||||
run: uv pip install -e ".[train,cli,visual]" --group typing
|
||||
|
||||
- name: 🔍 Run mypy
|
||||
run: uv run --no-sync mypy src/rfdetr/ --no-error-summary
|
||||
|
||||
- name: Minimize uv cache
|
||||
continue-on-error: true
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,26 @@
|
||||
name: PR Conflict Labeler
|
||||
|
||||
on:
|
||||
# So that PRs touching the same files as the push are updated
|
||||
push:
|
||||
branches: ["main", "release/*", "develop"]
|
||||
# So that the `dirtyLabel` is removed if conflicts are resolved
|
||||
# We recommend `pull_request_target` so that github secrets are available.
|
||||
# In `pull_request` we wouldn't be able to change labels of fork PRs
|
||||
pull_request_target:
|
||||
types: [synchronize]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
labeling:
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check if prs are dirty
|
||||
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3
|
||||
with:
|
||||
dirtyLabel: "has conflicts"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -0,0 +1,208 @@
|
||||
# Build and deploy MkDocs documentation to GitHub Pages (https://rfdetr.roboflow.com/)
|
||||
# using mike for versioned docs.
|
||||
#
|
||||
# Deploy matrix:
|
||||
# push develop → mike deploy develop (rfdetr.roboflow.com/develop/)
|
||||
# push release/latest → mike deploy latest (rfdetr.roboflow.com/latest/)
|
||||
# release published (stable/post) → mike deploy <base> (rfdetr.roboflow.com/<base>/; .postN stripped; RC/pre-release skipped)
|
||||
# workflow_dispatch target=develop → same as push develop
|
||||
# workflow_dispatch target=release/latest → same as push release/latest (→ latest alias)
|
||||
# workflow_dispatch target=<version tag> → mike deploy <tag>
|
||||
#
|
||||
# Every deploy also:
|
||||
# - Copies robots.txt, llms.txt, llms-full.txt to gh-pages root
|
||||
# - Regenerates sitemap.xml normalising versioned paths to /latest/
|
||||
# - Pings IndexNow (Bing) with canonical /latest/ URLs
|
||||
|
||||
name: Build and Publish Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["release/latest", "develop"]
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target:
|
||||
description: "Deploy target: 'develop', 'release/latest', or a version tag (e.g. '1.2.3'). Determines both the checkout ref and the mike version label."
|
||||
required: true
|
||||
default: "release/latest"
|
||||
|
||||
# Ensure only one concurrent deployment
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.ref_name || github.event_name == 'workflow_dispatch' && inputs.target || github.event_name == 'release' && github.event.release.tag_name || github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Restrict permissions by default
|
||||
permissions:
|
||||
contents: write # Required for committing to gh-pages
|
||||
pages: write # Required for deploying to Pages
|
||||
pull-requests: write # Required for PR comments
|
||||
|
||||
jobs:
|
||||
doc-deploy:
|
||||
name: Publish Docs
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: documentation-deployment
|
||||
url: https://rfdetr.roboflow.com/
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: 🔍 Validate dispatch target
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
TARGET="${{ inputs.target }}"
|
||||
if [ "$TARGET" = "develop" ] || [ "$TARGET" = "release/latest" ]; then
|
||||
echo "✓ Target '$TARGET' is valid"
|
||||
elif echo "$TARGET" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(\.post[0-9]+)?$'; then
|
||||
echo "✓ Target '$TARGET' is valid (version tag)"
|
||||
else
|
||||
echo "::error::Invalid target '$TARGET'. Must be 'develop', 'release/latest', or a version tag (e.g. '1.2.3' or '1.2.3.post1')"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ inputs.target || github.ref }}
|
||||
|
||||
- name: 🐍 Install uv and set Python
|
||||
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
||||
with:
|
||||
python-version: "3.10"
|
||||
activate-environment: true
|
||||
|
||||
- name: 🏗️ Install dependencies
|
||||
# Install PyTorch CPU-only first (UV_TORCH_BACKEND=cpu works with 'uv pip')
|
||||
run: uv pip install -e ".[plus]" --group docs
|
||||
|
||||
- name: ⚙️ Configure git for github-actions
|
||||
run: |
|
||||
git config --global user.name "${{ github.actor }}"
|
||||
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
|
||||
- name: 🚀 Deploy Development Docs
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
|
||||
env:
|
||||
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: uv run --no-sync mike deploy --push develop
|
||||
|
||||
- name: 🚀 Deploy Latest Branch Docs
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/release/latest'
|
||||
env:
|
||||
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: uv run --no-sync mike deploy --push --update-aliases latest
|
||||
|
||||
- name: 🚀 Deploy Release Docs
|
||||
if: github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease
|
||||
env:
|
||||
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
DOC_VERSION="${TAG%.post*}"
|
||||
uv run --no-sync mike deploy --push "$DOC_VERSION"
|
||||
|
||||
- name: 🚀 Deploy Docs (workflow_dispatch)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TARGET="${{ inputs.target }}"
|
||||
if [ "$TARGET" = "develop" ]; then
|
||||
uv run --no-sync mike deploy --push develop
|
||||
elif [ "$TARGET" = "release/latest" ]; then
|
||||
uv run --no-sync mike deploy --push --update-aliases latest
|
||||
else
|
||||
DOC_VERSION="${TARGET%.post*}"
|
||||
uv run --no-sync mike deploy --push "$DOC_VERSION"
|
||||
fi
|
||||
|
||||
- name: 🏗️ Build docs for artifact
|
||||
run: uv run --no-sync mkdocs build
|
||||
|
||||
- name: 📤 Upload docs artifact
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: docs-site
|
||||
path: site/
|
||||
retention-days: 7
|
||||
|
||||
- name: Deploy root static files to gh-pages
|
||||
if: >-
|
||||
(github.event_name == 'push' &&
|
||||
(github.ref == 'refs/heads/develop' ||
|
||||
github.ref == 'refs/heads/release/latest')) ||
|
||||
(github.event_name == 'release' &&
|
||||
github.event.action == 'published' &&
|
||||
!github.event.release.prerelease) ||
|
||||
github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
cp docs/root-static/robots.txt /tmp/robots.txt
|
||||
cp docs/root-static/llms.txt /tmp/llms.txt
|
||||
cp docs/root-static/llms-full.txt /tmp/llms-full.txt
|
||||
cp docs/root-static/cace9ef287cb8d641db90d4295fcb1e1.txt /tmp/indexnow.txt
|
||||
git fetch origin gh-pages:refs/remotes/origin/gh-pages
|
||||
git checkout -B gh-pages origin/gh-pages
|
||||
cp /tmp/robots.txt robots.txt
|
||||
cp /tmp/llms.txt llms.txt
|
||||
cp /tmp/llms-full.txt llms-full.txt
|
||||
cp /tmp/indexnow.txt cace9ef287cb8d641db90d4295fcb1e1.txt
|
||||
git add robots.txt llms.txt llms-full.txt cace9ef287cb8d641db90d4295fcb1e1.txt
|
||||
# Normalize versioned paths (/X.Y.Z/) to /latest/ so sitemap URLs are
|
||||
# not blocked by the User-agent: * Disallow rules in robots.txt.
|
||||
# latest/ may be a mike alias redirect (no sitemap.xml) — fall back to highest versioned dir.
|
||||
SITEMAP_SRC=""
|
||||
if [ -f latest/sitemap.xml ]; then
|
||||
SITEMAP_SRC="latest/sitemap.xml"
|
||||
else
|
||||
LATEST_VER=$(ls -d [0-9]* 2>/dev/null | grep -E '^[0-9]+\.[0-9]+' | sort -V | tail -1)
|
||||
if [ -n "$LATEST_VER" ] && [ -f "$LATEST_VER/sitemap.xml" ]; then
|
||||
SITEMAP_SRC="$LATEST_VER/sitemap.xml"
|
||||
elif [ -f develop/sitemap.xml ]; then
|
||||
SITEMAP_SRC="develop/sitemap.xml"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$SITEMAP_SRC" ]; then
|
||||
sed 's|rfdetr\.roboflow\.com/[^/]*/|rfdetr.roboflow.com/latest/|g' "$SITEMAP_SRC" > sitemap.xml
|
||||
git add sitemap.xml
|
||||
fi
|
||||
git diff --staged --quiet || git commit -m "chore: update root static files and sitemap"
|
||||
git push origin gh-pages || (git pull --rebase origin gh-pages && git push origin gh-pages)
|
||||
|
||||
# IndexNow key: cace9ef287cb8d641db90d4295fcb1e1
|
||||
# Key file served at https://rfdetr.roboflow.com/cace9ef287cb8d641db90d4295fcb1e1.txt
|
||||
# (deployed via "Deploy root static files" step above).
|
||||
# To rotate: generate new key, update docs/root-static/<key>.txt, replace key string here.
|
||||
- name: 📡 Notify IndexNow (Bing)
|
||||
if: >-
|
||||
(github.event_name == 'push' &&
|
||||
(github.ref == 'refs/heads/develop' ||
|
||||
github.ref == 'refs/heads/release/latest')) ||
|
||||
(github.event_name == 'release' &&
|
||||
github.event.action == 'published' &&
|
||||
!github.event.release.prerelease) ||
|
||||
github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
curl -s -o /dev/null -w "%{http_code}" -X POST "https://api.indexnow.org/IndexNow" \
|
||||
-H "Content-Type: application/json; charset=utf-8" \
|
||||
-d '{
|
||||
"host": "rfdetr.roboflow.com",
|
||||
"key": "cace9ef287cb8d641db90d4295fcb1e1",
|
||||
"keyLocation": "https://rfdetr.roboflow.com/cace9ef287cb8d641db90d4295fcb1e1.txt",
|
||||
"urlList": [
|
||||
"https://rfdetr.roboflow.com/",
|
||||
"https://rfdetr.roboflow.com/latest/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/install/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/pretrained/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/run/detection/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/run/segmentation/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/train/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/export/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/deploy/",
|
||||
"https://rfdetr.roboflow.com/latest/learn/benchmarks/"
|
||||
]
|
||||
}' || true
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Publish Pre-Releases to PyPI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Matches Semantic Versioning pre-release tags (e.g., 1.2.3a0, 1.2.3.a0, 1.2.3rc2, 1.2.3.rc2)
|
||||
# Format: MAJOR.MINOR.PATCH[.|]a|b|rcN
|
||||
- "[0-9]*.[0-9]*.[0-9]*a[0-9]*"
|
||||
- "[0-9]*.[0-9]*.[0-9]*.a[0-9]*"
|
||||
- "[0-9]*.[0-9]*.[0-9]*b[0-9]*"
|
||||
- "[0-9]*.[0-9]*.[0-9]*.b[0-9]*"
|
||||
- "[0-9]*.[0-9]*.[0-9]*rc[0-9]*"
|
||||
- "[0-9]*.[0-9]*.[0-9]*.rc[0-9]*"
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: ["main", "release/latest", "develop"]
|
||||
paths:
|
||||
- ".github/workflows/build-package.yml"
|
||||
- ".github/workflows/publish-pre-release.yml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-pkg:
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
|
||||
publish-pre-release:
|
||||
name: Publish Pre-release Package
|
||||
needs: build-pkg
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: test
|
||||
url: https://pypi.org/project/rfdetr/
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
id-token: write # Required for PyPI publishing
|
||||
steps:
|
||||
- name: 📥 Download distribution artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
- name: Display distribution files
|
||||
run: ls -lh dist/
|
||||
|
||||
- name: 🚀 Publish to PyPi
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
with:
|
||||
attestations: true
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Publish Releases to PyPI
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: ["main", "release/latest", "develop"]
|
||||
paths:
|
||||
- ".github/workflows/build-package.yml"
|
||||
- ".github/workflows/publish-release.yml"
|
||||
|
||||
jobs:
|
||||
build-pkg:
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
|
||||
publish-release:
|
||||
name: Publish Release Package
|
||||
needs: build-pkg
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: release
|
||||
url: https://pypi.org/project/rfdetr/
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
id-token: write # Required for PyPI publishing
|
||||
contents: write # Add this line
|
||||
steps:
|
||||
- name: 📥 Download distribution artifacts
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
- name: Display distribution files
|
||||
run: ls -lh dist/
|
||||
|
||||
- name: 🚀 Publish to PyPi
|
||||
# Only publish non-pre-releases
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
with:
|
||||
attestations: true
|
||||
|
||||
- name: 📤 Upload assets to GitHub Release
|
||||
if: github.event_name == 'release'
|
||||
uses: AButler/upload-release-assets@3d6774fae0ed91407dc5ae29d576b166536d1777 # v3.0
|
||||
with:
|
||||
files: "dist/*.whl;dist/*.tar.gz"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user