From 86253bdbed916f2a7016c63be1bb27c8d8316da2 Mon Sep 17 00:00:00 2001 From: turboderp <11859846+turboderp@users.noreply.github.com> Date: Sun, 3 May 2026 00:54:21 +0200 Subject: [PATCH] Update build actions --- .github/workflows/build.yml | 35 +++++++++++++++--- .github/workflows/build_windows_only.yml | 46 +++++++++++++++++------- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ef8ae1..ae27e9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -268,11 +268,11 @@ jobs: $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 if (-not $wheel) { throw "No wheel found in dist/" } - python -m pip install --upgrade wheel - python - <<'PY' + $verifyScript = @' from pathlib import Path from zipfile import ZipFile import os + import re wheel = next(Path("dist").glob("*.whl")) expected_torch = f"Requires-Dist: torch{os.environ['TORCH_SPEC']}" @@ -282,14 +282,39 @@ jobs: metadata_name = next(n for n in zf.namelist() if n.endswith(".dist-info/METADATA")) metadata = zf.read(metadata_name).decode("utf-8", errors="replace") + print(f"Wheel: {wheel}") print(expected_torch) print(expected_xformers) - if expected_torch not in metadata: + # setuptools/pkg_resources may normalize names by replacing _ with -. + # It may also insert a space before a parenthesized version specifier, + # depending on metadata generation path. Accept the common normalized forms. + torch_patterns = [ + re.escape(expected_torch), + re.escape(expected_torch).replace(re.escape("=="), r" ?=="), + ] + xformers_patterns = [ + re.escape(expected_xformers), + re.escape(expected_xformers).replace(re.escape(">="), r" ?>=").replace(re.escape("<"), r" ?<"), + ] + + if not any(re.search(p, metadata) for p in torch_patterns): + print("--- METADATA Requires-Dist lines ---") + for line in metadata.splitlines(): + if line.startswith("Requires-Dist:"): + print(line) raise SystemExit(f"Missing expected metadata line: {expected_torch}") - if expected_xformers not in metadata: + + if not any(re.search(p, metadata) for p in xformers_patterns): + print("--- METADATA Requires-Dist lines ---") + for line in metadata.splitlines(): + if line.startswith("Requires-Dist:"): + print(line) raise SystemExit(f"Missing expected metadata line: {expected_xformers}") - PY + '@ + + Set-Content -Path verify_wheel_metadata.py -Value $verifyScript -Encoding UTF8 + python verify_wheel_metadata.py - name: Upload wheel files to GitHub release if: steps.package_version.outputs.PACKAGE_VERSION != 'None' && inputs.release == '1' diff --git a/.github/workflows/build_windows_only.yml b/.github/workflows/build_windows_only.yml index 1627c92..427bb49 100644 --- a/.github/workflows/build_windows_only.yml +++ b/.github/workflows/build_windows_only.yml @@ -52,8 +52,10 @@ jobs: large-packages: false swap-storage: true + # Setup Python - uses: actions/checkout@v4 + # Get version string from package - name: Get version string id: package_version run: | @@ -67,10 +69,12 @@ jobs: Write-Output "PACKAGE_VERSION=None" >> "$env:GITHUB_OUTPUT" } + # Pin VS build tools to 17.9 for wider compat - name: Install VS2022 BuildTools 17.9.7 run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel" if: runner.os == 'Windows' + # Install uv for easier python setup - name: Install the latest version of uv and set the python version uses: astral-sh/setup-uv@v5 with: @@ -140,7 +144,6 @@ jobs: xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libcusolver-windows-x86_64-11.7.2.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libcurand-windows-x86_64-10.3.9.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libcufft-windows-x86_64-11.3.3.41-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y - echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 @@ -157,18 +160,12 @@ jobs: } } - # "network" method is currently broken due to an NVIDIA driver dependency issue - # https://forums.developer.nvidia.com/t/nvidia-driver-570-installation-is-broken-again/335219 - # "local" works but can only build one wheel per run due to a log artifact produced with the same filename by - # each job, during installation - # TODO: Find specific sub-packages - name: Install Linux CUDA ${{ matrix.cuda }} uses: Jimver/cuda-toolkit@v0.2.24 id: cuda-toolkit-Linux with: cuda: "${{ matrix.cuda }}" linux-local-args: '["--toolkit"]' - # method: "local" method: "network" if: runner.os != 'Windows' && matrix.cuda != '' @@ -271,11 +268,11 @@ jobs: $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 if (-not $wheel) { throw "No wheel found in dist/" } - python -m pip install --upgrade wheel - python - <<'PY' + $verifyScript = @' from pathlib import Path from zipfile import ZipFile import os + import re wheel = next(Path("dist").glob("*.whl")) expected_torch = f"Requires-Dist: torch{os.environ['TORCH_SPEC']}" @@ -285,14 +282,39 @@ jobs: metadata_name = next(n for n in zf.namelist() if n.endswith(".dist-info/METADATA")) metadata = zf.read(metadata_name).decode("utf-8", errors="replace") + print(f"Wheel: {wheel}") print(expected_torch) print(expected_xformers) - if expected_torch not in metadata: + # setuptools/pkg_resources may normalize names by replacing _ with -. + # It may also insert a space before a parenthesized version specifier, + # depending on metadata generation path. Accept the common normalized forms. + torch_patterns = [ + re.escape(expected_torch), + re.escape(expected_torch).replace(re.escape("=="), r" ?=="), + ] + xformers_patterns = [ + re.escape(expected_xformers), + re.escape(expected_xformers).replace(re.escape(">="), r" ?>=").replace(re.escape("<"), r" ?<"), + ] + + if not any(re.search(p, metadata) for p in torch_patterns): + print("--- METADATA Requires-Dist lines ---") + for line in metadata.splitlines(): + if line.startswith("Requires-Dist:"): + print(line) raise SystemExit(f"Missing expected metadata line: {expected_torch}") - if expected_xformers not in metadata: + + if not any(re.search(p, metadata) for p in xformers_patterns): + print("--- METADATA Requires-Dist lines ---") + for line in metadata.splitlines(): + if line.startswith("Requires-Dist:"): + print(line) raise SystemExit(f"Missing expected metadata line: {expected_xformers}") - PY + '@ + + Set-Content -Path verify_wheel_metadata.py -Value $verifyScript -Encoding UTF8 + python verify_wheel_metadata.py - name: Upload wheel files to GitHub release if: steps.package_version.outputs.PACKAGE_VERSION != 'None' && inputs.release == '1'