Update build actions

This commit is contained in:
turboderp
2026-05-03 00:54:21 +02:00
parent 45d1c8572f
commit 86253bdbed
2 changed files with 64 additions and 17 deletions

View File

@@ -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'

View File

@@ -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'