Support retried uv setup on Windows (#819)

This commit is contained in:
Glenn Jocher
2026-07-24 12:45:45 +02:00
parent 82ab95dda0
commit e06f2dcf6a
5 changed files with 32 additions and 17 deletions
+12
View File
@@ -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:
+1 -1
View File
@@ -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
+1 -1
View File
@@ -28,4 +28,4 @@
# ├── test_summarize_pr.py
# └── ...
__version__ = "0.2.27"
__version__ = "0.2.28"
+1 -1
View File
@@ -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
+17 -14
View File
@@ -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