|
| 1 | +name: Build WinPython (cycle file) |
| 2 | +# Draft, sitting beside github_workflows_build-YYYY_NN.yml for comparison. |
| 3 | +# |
| 4 | +# Same build as those, but everything cycle-specific comes from cycles/<cycle>.toml |
| 5 | +# instead of being copied into a new workflow each time. A new cycle is a new TOML. |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + cycle: |
| 11 | + description: 'Build cycle (file name in cycles/, without .toml)' |
| 12 | + required: true |
| 13 | + default: '2026_03' |
| 14 | + type: string |
| 15 | + python_versionf: |
| 16 | + description: 'Python version to build; must exist in that cycle file' |
| 17 | + required: true |
| 18 | + default: '3.14' |
| 19 | + type: choice |
| 20 | + options: |
| 21 | + - '3.13' |
| 22 | + - '3.14' |
| 23 | + - '3.14F' |
| 24 | + - '3.15' |
| 25 | + - '3.15F' |
| 26 | + |
| 27 | +env: |
| 28 | + WINPYARCH: "64" |
| 29 | + dotwheelhouse: "dotpython\\wheelhouse\\included.wheels" |
| 30 | + |
| 31 | +jobs: |
| 32 | + config: |
| 33 | + # reads the cycle file once, instead of once per matrix leg |
| 34 | + runs-on: ubuntu-latest |
| 35 | + outputs: |
| 36 | + ver2: ${{ steps.cfg.outputs.ver2 }} |
| 37 | + src: ${{ steps.cfg.outputs.src }} |
| 38 | + sha: ${{ steps.cfg.outputs.sha }} |
| 39 | + cycle_dir: ${{ steps.cfg.outputs.cycle_dir }} |
| 40 | + release_level: ${{ steps.cfg.outputs.release_level }} |
| 41 | + pandoc_source: ${{ steps.cfg.outputs.pandoc_source }} |
| 42 | + pandoc_sha256: ${{ steps.cfg.outputs.pandoc_sha256 }} |
| 43 | + matrix: ${{ steps.cfg.outputs.matrix }} |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v6 |
| 46 | + with: |
| 47 | + persist-credentials: false |
| 48 | + |
| 49 | + - name: Read cycle configuration |
| 50 | + id: cfg |
| 51 | + run: python .github/scripts/cycle_config.py "cycles/${{ inputs.cycle }}.toml" "${{ inputs.python_versionf }}" |
| 52 | + |
| 53 | + build-winpython: |
| 54 | + needs: config |
| 55 | + runs-on: windows-latest |
| 56 | + strategy: |
| 57 | + fail-fast: true |
| 58 | + matrix: ${{ fromJSON(needs.config.outputs.matrix) }} |
| 59 | + |
| 60 | + env: |
| 61 | + PYTHON_VERSIONF: ${{ inputs.python_versionf }} |
| 62 | + WINPYFLAVOR: ${{ matrix.flavor.name }} |
| 63 | + PANDOC: ${{ matrix.flavor.PANDOC }} |
| 64 | + WINPYARCHDET: ${{ matrix.flavor.WINPYARCHDET }} |
| 65 | + my_cycle: ${{ needs.config.outputs.cycle_dir }} |
| 66 | + my_release_level: ${{ needs.config.outputs.release_level }} |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Checkout repository |
| 70 | + uses: actions/checkout@v6 |
| 71 | + |
| 72 | + - name: Set static and matrix variables based on selected Python version |
| 73 | + shell: pwsh |
| 74 | + env: |
| 75 | + PYTHON_VERSIONF: ${{ env.PYTHON_VERSIONF }} |
| 76 | + WINPYARCHDET: ${{ env.WINPYARCHDET }} |
| 77 | + WINPYVER2: ${{ needs.config.outputs.ver2 }} |
| 78 | + my_cycle: ${{ env.my_cycle }} |
| 79 | + my_release_level: ${{ env.my_release_level }} |
| 80 | + FLAVOR_NAME: ${{ matrix.flavor.name }} |
| 81 | + run: | |
| 82 | + # Normalize PYTHON_VERSION by removing trailing 'F' if present |
| 83 | + $PYTHON_VERSION = $env:PYTHON_VERSIONF -replace 'F$','' |
| 84 | + Add-Content -Path $env:GITHUB_ENV -Value "PYTHON_VERSION=$PYTHON_VERSION" |
| 85 | +
|
| 86 | + # Detect architecture (64 or 64F) |
| 87 | + $detected_arch = if ($env:PYTHON_VERSIONF -like '*F') { '64F' } else { '64' } |
| 88 | +
|
| 89 | + $WINPYVER2 = $env:WINPYVER2 |
| 90 | + $BUILD_LOCATION = "WPy64-" + ($WINPYVER2 -replace '[.]', "") |
| 91 | + Add-Content -Path $env:GITHUB_ENV -Value "build_location=$BUILD_LOCATION" |
| 92 | +
|
| 93 | + # ver2-vs-source consistency is checked in cycle_config.py |
| 94 | +
|
| 95 | + $WINPYREQUIREMENTS = '' |
| 96 | + $WINPYREQUIREMENTSwhl = '' |
| 97 | +
|
| 98 | + # Generate requirement files expected names dynamically |
| 99 | + $V_TAG = $env:WINPYVER2 -replace '\.', '_' |
| 100 | + $testreq = "$($env:my_cycle)/requir.64-$($V_TAG)$($env:FLAVOR_NAME)$($env:my_release_level).txt" |
| 101 | + $testwhl = "$($env:my_cycle)/requir.64-$($V_TAG)$($env:FLAVOR_NAME)$($env:my_release_level)_wheels.txt" |
| 102 | +
|
| 103 | + Write-Host "Checking for requirements files: $testreq and $testwhl (expected arch $detected_arch)" |
| 104 | +
|
| 105 | + if ($env:WINPYARCHDET -eq $detected_arch -and (Test-Path $testreq)) { |
| 106 | + $WINPYREQUIREMENTS = $testreq |
| 107 | + Write-Host "Found $WINPYREQUIREMENTS" |
| 108 | + if (Test-Path $testwhl) { |
| 109 | + $WINPYREQUIREMENTSwhl = $testwhl |
| 110 | + Write-Host "Found also $WINPYREQUIREMENTSwhl" |
| 111 | + } |
| 112 | + } |
| 113 | +
|
| 114 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYREQUIREMENTS=$WINPYREQUIREMENTS" |
| 115 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYREQUIREMENTSwhl=$WINPYREQUIREMENTSwhl" |
| 116 | +
|
| 117 | + $WINPYLOCKFILE = '' |
| 118 | + $WINPYLOCKFILEwhl = '' |
| 119 | +
|
| 120 | + # Generate pylock files expected names dynamically |
| 121 | + $testreq = "$($env:my_cycle)/pylock.64-$($V_TAG)$($env:FLAVOR_NAME)$($env:my_release_level).toml" |
| 122 | + $testwhl = "$($env:my_cycle)/pylock.64-$($V_TAG)$($env:FLAVOR_NAME)$($env:my_release_level)_wheels.toml" |
| 123 | +
|
| 124 | + Write-Host "Checking for pylock files: $testreq and $testwhl (expected arch $detected_arch)" |
| 125 | +
|
| 126 | + if ($env:WINPYARCHDET -eq $detected_arch -and (Test-Path $testreq)) { |
| 127 | + $WINPYLOCKFILE = $testreq |
| 128 | + Write-Host "Found $WINPYLOCKFILE" |
| 129 | + if (Test-Path $testwhl) { |
| 130 | + $WINPYLOCKFILEwhl = $testwhl |
| 131 | + Write-Host "Found also $WINPYLOCKFILEwhl" |
| 132 | + } |
| 133 | + } |
| 134 | +
|
| 135 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYLOCKFILE=$WINPYLOCKFILE" |
| 136 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYLOCKFILEwhl=$WINPYLOCKFILEwhl" |
| 137 | +
|
| 138 | + $ARTIFACT_NAME = "publish_${PYTHON_VERSION}$($env:FLAVOR_NAME)" |
| 139 | + Add-Content -Path $env:GITHUB_ENV -Value "ARTIFACT_NAME=$ARTIFACT_NAME" |
| 140 | +
|
| 141 | + $destwheelhouse = "$BUILD_LOCATION\wheelhouse\included.wheels" |
| 142 | + Add-Content -Path $env:GITHUB_ENV -Value "destwheelhouse=$destwheelhouse" |
| 143 | +
|
| 144 | + $WINPYVER = "${WINPYVER2}$($env:FLAVOR_NAME)$($env:my_release_level)" |
| 145 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYVER=$WINPYVER" |
| 146 | +
|
| 147 | + # Store WINPYVER2 in env for later steps |
| 148 | + Add-Content -Path $env:GITHUB_ENV -Value "WINPYVER2=$WINPYVER2" |
| 149 | +
|
| 150 | + - name: Download, verify and extract python standalone |
| 151 | + if: env.WINPYLOCKFILE != '' |
| 152 | + uses: ./.github/actions/python-setup |
| 153 | + with: |
| 154 | + python_source: ${{ needs.config.outputs.src }} |
| 155 | + python_sha256: ${{ needs.config.outputs.sha }} |
| 156 | + build_location: ${{ env.build_location }} |
| 157 | + |
| 158 | + - name: Download, checking hash and integrating pandoc binary |
| 159 | + if: env.WINPYLOCKFILE != '' && env.PANDOC == '1' |
| 160 | + uses: ./.github/actions/pandoc-setup |
| 161 | + with: |
| 162 | + pandoc_source: ${{ needs.config.outputs.pandoc_source }} |
| 163 | + pandoc_sha256: ${{ needs.config.outputs.pandoc_sha256 }} |
| 164 | + build_location: ${{ env.build_location }} |
| 165 | + |
| 166 | + - name: Upgrade pip and patch launchers |
| 167 | + if: env.WINPYLOCKFILE != '' |
| 168 | + shell: pwsh |
| 169 | + run: | |
| 170 | + & "$env:build_location\python\python.exe" -m pip install --upgrade --force-reinstall pip --no-warn-script-location |
| 171 | + & "$env:build_location\python\python.exe" -c "from wppm import wppm;dist=wppm.Distribution();dist.patch_standard_packages('pip', to_movable=True)" |
| 172 | +
|
| 173 | + - name: Download all requirements |
| 174 | + if: ${{ env.WINPYLOCKFILE != '' }} |
| 175 | + shell: pwsh |
| 176 | + run: | |
| 177 | + $py = "$env:build_location\python\python.exe" |
| 178 | + & $py -m pip download --dest $env:dotwheelhouse --no-deps --require-hashes -r $env:WINPYLOCKFILE |
| 179 | + if ($env:WINPYLOCKFILEwhl -ne '') { |
| 180 | + & $py -m pip download --dest $env:destwheelhouse --no-deps --require-hashes -r $env:WINPYLOCKFILEwhl |
| 181 | + } |
| 182 | +
|
| 183 | + - name: Install lockfile |
| 184 | + if: env.WINPYLOCKFILE != '' |
| 185 | + shell: pwsh |
| 186 | + run: | |
| 187 | + & "$env:build_location\python\python.exe" -m pip install --no-deps --require-hashes -r $env:WINPYLOCKFILE --no-warn-script-location |
| 188 | +
|
| 189 | + - name: Generate Assets and Hashes |
| 190 | + if: env.WINPYLOCKFILE != '' |
| 191 | + uses: ./.github/actions/publish-winpython |
| 192 | + with: |
| 193 | + build_location: ${{ env.build_location }} |
| 194 | + winpy_flavor: ${{ env.WINPYFLAVOR }} |
| 195 | + winpy_arch: ${{ env.WINPYARCH }} |
| 196 | + winpy_ver: ${{ env.WINPYVER }} |
| 197 | + winpy_ver2: ${{ env.WINPYVER2 }} |
| 198 | + dotwheelhouse: ${{ env.dotwheelhouse }} |
| 199 | + winpy_requirements_whl: ${{ env.WINPYREQUIREMENTSwhl }} |
| 200 | + format_zip: ${{ matrix.flavor.formats.zip }} |
| 201 | + format_7z: ${{ matrix.flavor.formats['7z'] }} |
| 202 | + format_exe: ${{ matrix.flavor.formats.exe }} |
| 203 | + |
| 204 | + - name: Upload artifacts |
| 205 | + if: env.WINPYLOCKFILE != '' |
| 206 | + uses: actions/upload-artifact@v6 |
| 207 | + with: |
| 208 | + name: ${{ env.ARTIFACT_NAME }} |
| 209 | + path: publish_output |
| 210 | + retention-days: 66 # keeps artifact for 66 days |
0 commit comments