From e06f2dcf6afbe4ec61c880dc935de446c42d064b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 17 Jul 2026 12:15:22 +0200 Subject: [PATCH] Support retried uv setup on Windows (#819) --- .github/workflows/ci.yml | 12 ++++++++++++ README.md | 2 +- actions/__init__.py | 2 +- setup-uv/README.md | 2 +- setup-uv/action.yml | 31 +++++++++++++++++-------------- 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2a9b39..49f185a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,18 @@ permissions: id-token: write # Required for Codecov OIDC uploads jobs: + Setup-uv-Windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v7 + - uses: ./setup-uv + with: + python-version: "3.14" + activate-environment: true + - run: | + uv --version + python -c "import os, sys; assert sys.version_info[:2] == (3, 14); assert os.environ['VIRTUAL_ENV'].endswith(r'\.venv')" + Test: runs-on: ${{ matrix.os }} strategy: diff --git a/README.md b/README.md index e4d38c0..0c6a4f1 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ Check every pull request commit author against the central Ultralytics CLA signa ### 6. Setup uv Action -Install the latest uv with retry support on Linux and macOS and optionally activate a Python environment. +Install the latest uv with retry support and optionally activate a Python environment. ```yaml - uses: ultralytics/actions/setup-uv@main diff --git a/actions/__init__.py b/actions/__init__.py index eaff5ae..779099e 100644 --- a/actions/__init__.py +++ b/actions/__init__.py @@ -28,4 +28,4 @@ # ├── test_summarize_pr.py # └── ... -__version__ = "0.2.27" +__version__ = "0.2.28" diff --git a/setup-uv/README.md b/setup-uv/README.md index 6b04de0..53950a3 100644 --- a/setup-uv/README.md +++ b/setup-uv/README.md @@ -1,6 +1,6 @@ # Setup uv Action -Installs the latest [uv](https://docs.astral.sh/uv/) release with retry support on Linux and macOS and optionally activates a Python virtual environment. +Installs the latest [uv](https://docs.astral.sh/uv/) release with retry support and optionally activates a Python virtual environment. ## Usage diff --git a/setup-uv/action.yml b/setup-uv/action.yml index d7ad321..802d1b8 100644 --- a/setup-uv/action.yml +++ b/setup-uv/action.yml @@ -1,7 +1,7 @@ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license name: "Setup uv" -description: "Install the latest uv with retry on Linux and macOS and optionally activate a Python environment" +description: "Install the latest uv with retry and optionally activate a Python environment" inputs: python-version: description: "Python version for uv commands" @@ -15,21 +15,18 @@ inputs: runs: using: "composite" steps: - - name: Validate platform - shell: bash - run: | - if [ "$RUNNER_OS" = "Windows" ]; then - echo "::error::setup-uv supports Linux and macOS runners" - exit 1 - fi - - name: Install uv - uses: ultralytics/actions/retry@main + uses: ultralytics/actions/retry@a9e123c43a227f70901da045ca6ef1c08c6bb39d with: run: | set -o pipefail - curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="$RUNNER_TEMP/uv-bin" sh - echo "$RUNNER_TEMP/uv-bin" >> "$GITHUB_PATH" + if [ "$RUNNER_OS" = "Windows" ]; then + powershell -NoProfile -ExecutionPolicy Bypass -Command '$env:UV_UNMANAGED_INSTALL = $env:RUNNER_TEMP + "\uv-bin"; irm https://astral.sh/uv/install.ps1 | iex' + echo "$RUNNER_TEMP\uv-bin" >> "$GITHUB_PATH" + else + curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="$RUNNER_TEMP/uv-bin" sh + echo "$RUNNER_TEMP/uv-bin" >> "$GITHUB_PATH" + fi - name: Configure environment shell: bash @@ -43,6 +40,12 @@ runs: fi if [ "$ACTIVATE_ENVIRONMENT" = "true" ]; then uv venv --clear - echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV" - echo "$PWD/.venv/bin" >> "$GITHUB_PATH" + if [ "$RUNNER_OS" = "Windows" ]; then + venv_path=$(cygpath -w "$PWD/.venv") + echo "VIRTUAL_ENV=$venv_path" >> "$GITHUB_ENV" + echo "$venv_path\Scripts" >> "$GITHUB_PATH" + else + echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV" + echo "$PWD/.venv/bin" >> "$GITHUB_PATH" + fi fi