From 121307a246628e018a329eecffcafe84d8e20da0 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 19 Nov 2024 02:04:05 +0100 Subject: [PATCH] Update Actions with uv installs (#17620) --- .github/workflows/ci.yaml | 29 ++++++++++++----------------- .github/workflows/docs.yml | 6 +++--- .github/workflows/format.yml | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 545ff0311f..891e134da0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,16 +52,15 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: "pip" # caching pip dependencies + - uses: astral-sh/setup-uv@v3 - name: Install requirements shell: bash # for Windows compatibility run: | - python -m pip install --upgrade pip wheel - pip install . --extra-index-url https://download.pytorch.org/whl/cpu + uv pip install --system . --extra-index-url https://download.pytorch.org/whl/cpu - name: Check environment run: | yolo checks - pip list + uv pip list - name: Test HUB training shell: python env: @@ -111,6 +110,7 @@ jobs: - name: Install requirements shell: bash # for Windows compatibility run: | + # Warnings: uv causes numpy errors during benchmarking python -m pip install --upgrade pip wheel pip install -e ".[export]" "coverage[toml]" --extra-index-url https://download.pytorch.org/whl/cpu - name: Check environment @@ -172,12 +172,11 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: "pip" # caching pip dependencies + - uses: astral-sh/setup-uv@v3 - name: Install requirements shell: bash # for Windows compatibility run: | # CoreML must be installed before export due to protobuf error from AutoInstall - python -m pip install --upgrade pip wheel slow="" torch="" if [ "${{ matrix.torch }}" == "1.8.0" ]; then @@ -186,11 +185,11 @@ jobs: if [[ "${{ github.event_name }}" =~ ^(schedule|workflow_dispatch)$ ]]; then slow="pycocotools mlflow" fi - pip install -e ".[export]" $torch $slow pytest-cov --extra-index-url https://download.pytorch.org/whl/cpu + uv pip install --system -e ".[export]" $torch $slow pytest-cov --extra-index-url https://download.pytorch.org/whl/cpu - name: Check environment run: | yolo checks - pip list + uv pip list - name: Pytest tests shell: bash # for Windows compatibility run: | @@ -213,12 +212,13 @@ jobs: runs-on: gpu-latest steps: - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v3 - name: Install requirements - run: pip install . pytest-cov + run: uv pip install --system . pytest-cov - name: Check environment run: | yolo checks - pip list + uv pip list - name: Pytest tests run: | slow="" @@ -294,13 +294,8 @@ jobs: channels: conda-forge,defaults channel-priority: true activate-environment: anaconda-client-env - - name: Cleanup toolcache - run: | - echo "Free space before deletion:" - df -h / - rm -rf /opt/hostedtoolcache - echo "Free space after deletion:" - df -h / + - name: Cleanup disk space + uses: ultralytics/actions/cleanup-disk@main - name: Install Linux packages run: | # Fix cv2 ImportError: 'libEGL.so.1: cannot open shared object file: No such file or directory' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ea6def886a..0210da5457 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,7 +29,7 @@ on: jobs: Docs: if: github.repository == 'ultralytics/ultralytics' - runs-on: macos-14 + runs-on: ubuntu-latest steps: - name: Git config run: | @@ -46,9 +46,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.x" - cache: "pip" # caching pip dependencies + - uses: astral-sh/setup-uv@v3 - name: Install Dependencies - run: pip install ruff black tqdm minify-html mkdocs-material "mkdocstrings[python]" mkdocs-jupyter mkdocs-redirects mkdocs-ultralytics-plugin mkdocs-macros-plugin + run: uv pip install --system ruff black tqdm minify-html mkdocs-material "mkdocstrings[python]" mkdocs-jupyter mkdocs-redirects mkdocs-ultralytics-plugin mkdocs-macros-plugin - name: Ruff fixes continue-on-error: true run: ruff check --fix --unsafe-fixes --select D --ignore=D100,D104,D203,D205,D212,D213,D401,D406,D407,D413 . diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index acd2865658..28720abfba 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -15,7 +15,7 @@ on: jobs: format: - runs-on: macos-14 + runs-on: ubuntu-latest steps: - name: Run Ultralytics Formatting uses: ultralytics/actions@main