11# .github/workflows/windows-build.yml
2- # This workflow correctly downloads a full, portable Python runtime, prepares it,
3- # and bundles it with the Nuitka-compiled application for a fully standalone release.
4- # It includes exhaustive verification steps to prevent incorrect builds .
2+ # This workflow correctly downloads a portable Python runtime, prepares it with pip ,
3+ # forcefully removes all debugging symbols (.pdb files), and then bundles the
4+ # clean runtime with the Nuitka-compiled application .
55
66name : Build and Release Windows App
77
@@ -28,66 +28,64 @@ jobs:
2828 with :
2929 python-version : ' 3.11'
3030
31+ - name : Install zstd decompressor
32+ run : choco install zstandard -y
33+
3134 - name : Prepare Portable Python Runtime
3235 shell : pwsh
3336 run : |
34- # 1. Download the correct 'install_only' standalone Python distribution.
35- $pythonVersion = "3.11.13"
36- $releaseTag = "20250808"
37- $fileName = "cpython-$($pythonVersion)+$($releaseTag)-x86_64-pc-windows-msvc-install_only.tar.gz"
38- $url = "https://github.com/astral-sh/python-build-standalone/releases/download/$releaseTag/$fileName"
37+ # 1. Download the specified full, pre-built, standalone Python distribution.
38+ $url = "https://github.com/astral-sh/python-build-standalone/releases/download/20250808/cpython-3.11.13+20250808-x86_64-pc-windows-msvc-pgo-full.tar.zst"
3939
40- Write-Host "Downloading Python runtime from $url"
41- Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.gz "
40+ Write-Host "Downloading Python runtime from hardcoded URL: $url"
41+ Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst "
4242
43- # 2. Decompress the archive.
44- Write-Host "Decompressing Python runtime..."
45- tar -xzf python-standalone.tar.gz
46-
47- # 3. Move the contents to the 'python_runtime' directory.
48- New-Item -ItemType Directory -Force -Path python_runtime
49- Move-Item -Path "python\*" -Destination "python_runtime"
50- Remove-Item "python" -Recurse -Force
43+ # 2. Decompress the archive in two steps: zstd -> tar.
44+ Write-Host "Decompressing python-standalone.tar.zst..."
45+ zstd -d python-standalone.tar.zst -o python-standalone.tar
5146
52- # 4. Download the official pip bootstrap script.
53- Write-Host "Downloading get-pip.py..."
54- Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile "python_runtime\get-pip.py"
47+ Write-Host "Extracting python-standalone.tar..."
48+ tar -xf python-standalone.tar
5549
56- # 5. Run the bootstrap script to install pip.
57- Write-Host "Installing pip into the portable runtime..."
58- .\python_runtime\python.exe .\python_runtime\get-pip.py
50+ # 3. Move the contents from the correct 'python\install' subfolder.
51+ New-Item -ItemType Directory -Force -Path python_runtime
52+ Write-Host "Moving extracted runtime from 'python\install' to 'python_runtime'..."
53+ Move-Item -Path "python\install\*" -Destination "python_runtime"
54+ Remove-Item "python", "python-standalone.tar.zst", "python-standalone.tar" -Recurse -Force
5955
60- # 6. Clean up.
61- Remove-Item "python_runtime\get-pip.py"
6256 Write-Host "Python runtime prepared."
6357
64- - name : Insane Sanity Check of Python Runtime
58+ - name : Clean and Verify Python Runtime
6559 shell : pwsh
6660 run : |
67- Write-Host "--- RUNNING EXTREME VERIFICATION ---"
61+ Write-Host "--- RUNNING FINAL VERIFICATION ---"
6862 $runtimePath = "python_runtime"
6963
64+ # Step 1: Forcefully remove all .pdb files from the runtime.
65+ Write-Host "Removing all .pdb files..."
66+ Get-ChildItem -Path $runtimePath -Recurse -Filter "*.pdb" | Remove-Item -Force
67+ Write-Host "[PASS] .pdb file removal complete."
68+
7069 # Check 1: python.exe must exist.
7170 $pythonExePath = Join-Path $runtimePath "python.exe"
7271 if (-not (Test-Path $pythonExePath)) {
73- Write-Host "CRITICAL FAILURE: '$($pythonExePath)' does not exist. The wrong package was downloaded or extracted. "
72+ Write-Host "CRITICAL FAILURE: '$($pythonExePath)' does not exist."
7473 exit 1
7574 }
7675 Write-Host "[PASS] python.exe found."
7776
7877 # Check 2: pip.exe must exist.
7978 $pipExePath = Join-Path $runtimePath "Scripts\pip.exe"
8079 if (-not (Test-Path $pipExePath)) {
81- Write-Host "CRITICAL FAILURE: '$($pipExePath)' does not exist. Pip bootstrapping failed. "
80+ Write-Host "CRITICAL FAILURE: '$($pipExePath)' does not exist."
8281 exit 1
8382 }
8483 Write-Host "[PASS] pip.exe found."
8584
86- # Check 3: There must NOT be any .pdb files.
85+ # Check 3: There must NOT be any .pdb files remaining .
8786 $pdbFiles = Get-ChildItem -Path $runtimePath -Recurse -Filter "*.pdb"
8887 if ($pdbFiles) {
89- Write-Host "CRITICAL FAILURE: Found .pdb files in the runtime directory. This indicates the wrong package type (a debug or dev package) was downloaded."
90- $pdbFiles | ForEach-Object { Write-Host " - $($_.FullName)" }
88+ Write-Host "CRITICAL FAILURE: Found .pdb files after cleanup step."
9189 exit 1
9290 }
9391 Write-Host "[PASS] No .pdb files found."
0 commit comments