Enable Windows on Arm GitHub runners (#131994)

This commit is contained in:
Diego Russo 2025-04-03 21:32:29 +01:00 committed by GitHub
parent b6c92ec419
commit 0dbaeb94a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 21 deletions

View file

@ -164,10 +164,12 @@ jobs:
- false - false
- true - true
include: include:
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64 # Forks don't have access to Windows on Arm runners. These jobs are skipped below:
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
arch: arm64 arch: arm64
free-threading: false free-threading: false
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64 # Forks don't have access to Windows on Arm runners. These jobs are skipped below:
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
arch: arm64 arch: arm64
free-threading: true free-threading: true
- os: windows-latest - os: windows-latest
@ -187,12 +189,18 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os:
- windows-latest
arch: arch:
- x86 - x86
- x64 - x64
- arm64 include:
# Forks don't have access to Windows on Arm runners. These jobs are skipped below:
- os: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
arch: arm64
uses: ./.github/workflows/reusable-windows-msi.yml uses: ./.github/workflows/reusable-windows-msi.yml
with: with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
build-macos: build-macos:

View file

@ -74,7 +74,8 @@ jobs:
runner: windows-latest runner: windows-latest
- target: aarch64-pc-windows-msvc/msvc - target: aarch64-pc-windows-msvc/msvc
architecture: ARM64 architecture: ARM64
runner: windows-latest # Forks don't have access to Windows on Arm runners. These jobs are skipped below:
runner: ${{ github.repository_owner == 'python' && 'windows-aarch64' || 'windows-latest' }}
- target: x86_64-apple-darwin/clang - target: x86_64-apple-darwin/clang
architecture: x86_64 architecture: x86_64
runner: macos-13 runner: macos-13
@ -95,25 +96,19 @@ jobs:
with: with:
python-version: '3.11' python-version: '3.11'
- name: Native Windows - name: Windows
if: runner.os == 'Windows' && matrix.architecture != 'ARM64' # Forks don't have access to Windows on Arm runners. Skip those:
if: runner.os == 'Windows' && (matrix.architecture != 'ARM64' || github.repository_owner == 'python')
run: | run: |
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0 choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} ./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3 ./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
# No tests (yet):
- name: Emulated Windows
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
run: |
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966. # The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same # This is a bug in the macOS runner image where the pre-installed Python is installed in the same
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes # directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
# the symlink to the pre-installed Python so that the Homebrew Python is used instead. # the symlink to the pre-installed Python so that the Homebrew Python is used instead.
- name: Native macOS - name: macOS
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
brew update brew update
@ -124,7 +119,7 @@ jobs:
make all --jobs 4 make all --jobs 4
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3 ./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
- name: Native Linux - name: Linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }} sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}

View file

@ -3,6 +3,10 @@ name: Reusable Windows MSI
on: on:
workflow_call: workflow_call:
inputs: inputs:
os:
description: OS to run on
required: true
type: string
arch: arch:
description: CPU architecture description: CPU architecture
required: true required: true
@ -17,7 +21,7 @@ env:
jobs: jobs:
build: build:
name: installer for ${{ inputs.arch }} name: installer for ${{ inputs.arch }}
runs-on: windows-latest runs-on: ${{ inputs.os }}
timeout-minutes: 60 timeout-minutes: 60
env: env:
ARCH: ${{ inputs.arch }} ARCH: ${{ inputs.arch }}
@ -27,5 +31,7 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- name: Build CPython installer - name: Build CPython installer
# Forks don't have access to Windows on Arm runners. Skip those:
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
run: ./Tools/msi/build.bat --doc -"${ARCH}" run: ./Tools/msi/build.bat --doc -"${ARCH}"
shell: bash shell: bash

View file

@ -24,7 +24,7 @@ env:
jobs: jobs:
build: build:
name: ${{ inputs.arch == 'arm64' && 'build' || 'build and test' }} (${{ inputs.arch }}) name: Build and test (${{ inputs.arch }})
runs-on: ${{ inputs.os }} runs-on: ${{ inputs.os }}
timeout-minutes: 60 timeout-minutes: 60
env: env:
@ -37,17 +37,21 @@ jobs:
if: inputs.arch != 'Win32' if: inputs.arch != 'Win32'
run: echo "::add-matcher::.github/problem-matchers/msvc.json" run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Build CPython - name: Build CPython
# Forks don't have access to Windows on Arm runners. Skip those:
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
run: >- run: >-
.\\PCbuild\\build.bat .\\PCbuild\\build.bat
-e -d -v -e -d -v
-p "${ARCH}" -p "${ARCH}"
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
shell: bash shell: bash
- name: Display build info # FIXME(diegorusso): remove the `if` - name: Display build info
if: inputs.arch != 'arm64' # Forks don't have access to Windows on Arm runners. Skip those:
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
run: .\\python.bat -m test.pythoninfo run: .\\python.bat -m test.pythoninfo
- name: Tests # FIXME(diegorusso): remove the `if` - name: Tests
if: inputs.arch != 'arm64' # Forks don't have access to Windows on Arm runners. Skip those:
if: inputs.arch != 'arm64' || github.repository_owner == 'python'
run: >- run: >-
.\\PCbuild\\rt.bat .\\PCbuild\\rt.bat
-p "${ARCH}" -p "${ARCH}"