Use relocatable shebang with space-in-path robustness #2447
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows Python build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
pythonbuild: | |
runs-on: 'windows-2022' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Emit rustc version | |
run: | | |
rustc --version > .rustc-version | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
C:/Rust/.cargo/registry | |
C:/Rust/.cargo/git | |
target | |
key: ${{ runner.os }}-pythonbuild-${{ hashFiles('Cargo.lock', '.rustc-version') }} | |
- name: Build | |
run: | | |
cargo build --release | |
- name: Upload executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pythonbuild | |
path: target/release/pythonbuild.exe | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
py: | |
- 'cpython-3.9' | |
- 'cpython-3.10' | |
- 'cpython-3.11' | |
- 'cpython-3.12' | |
- 'cpython-3.13' | |
vcvars: | |
- 'vcvars32.bat' | |
- 'vcvars64.bat' | |
options: | |
- 'pgo' | |
include: | |
- py: 'cpython-3.13' | |
vcvars: 'vcvars32.bat' | |
options: 'freethreaded+pgo' | |
- py: 'cpython-3.13' | |
vcvars: 'vcvars64.bat' | |
options: 'freethreaded+pgo' | |
needs: pythonbuild | |
runs-on: 'windows-2022' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Cygwin Environment | |
uses: cygwin/cygwin-install-action@49f298a7ebb00d4b3ddf58000c3e78eff5fbd6b9 | |
with: | |
packages: autoconf automake libtool | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Download pythonbuild Executable | |
uses: actions/download-artifact@v4 | |
with: | |
name: pythonbuild | |
# We need to do this before we activate the VC++ environment or else binary packages | |
# don't get compiled properly. | |
- name: Bootstrap Python environment | |
run: | | |
py.exe -3.9 build-windows.py --help | |
- name: Build | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\${{ matrix.vcvars }}" | |
py.exe -3.9 build-windows.py --python ${{ matrix.py }} --sh c:\cygwin\bin\sh.exe --options ${{ matrix.options }} | |
- name: Validate Distribution | |
run: | | |
$Dists = Resolve-Path -Path "dist/*.tar.zst" -Relative | |
.\pythonbuild.exe validate-distribution --run $Dists | |
- name: Upload Distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.py }}-${{ matrix.vcvars }}-${{ matrix.options }} | |
path: dist/* |