Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ffa3173
Add native Windows arm64 build support (WIP)
knightmare2600 Aug 9, 2026
8cc9d82
Fix VS detection fallback to vswhere.exe
knightmare2600 Aug 9, 2026
427cec0
Fix test_windows_arm64 bootstrap Python version
knightmare2600 Aug 9, 2026
94d80f0
Bundle arm64 OpenSSL dev tree so pip installs can build against it
knightmare2600 Aug 9, 2026
f8fb68c
Remove WIP-only workflow_dispatch trigger from pr.yml
knightmare2600 Aug 10, 2026
45f9d5f
Merge branch 'main' into windows-arm64-support
knightmare2600 Aug 26, 2026
ebf2ea3
Get verify tests to pass on Windows arm64
dwoz Aug 30, 2026
0c27980
Merge branch 'main' into windows-arm64-support
knightmare2600 Sep 2, 2026
2cbe669
Fix win-arm64 verify tests: pygit2 wheel availability + ruff-format
dwoz Sep 3, 2026
ae000cd
Merge branch 'main' into windows-arm64-support
dwoz Nov 2, 2026
ec95c21
Detect v140 under VS 2022 17.14+ / VS 18 per-install MSBuild layout
dwoz Nov 5, 2026
614132f
Unbreak Windows arm64 build under VS Enterprise 2026 (VS 18)
dwoz Nov 6, 2026
c3cfdda
arm64: stop pinning PlatformToolset to v143 under VS 18
dwoz Nov 6, 2026
15b1024
arm64: pick installed PlatformToolset dynamically for VS 18 builds
dwoz Nov 6, 2026
c883727
arm64: pass discovered PlatformToolset via env var not /p:
dwoz Nov 6, 2026
9658d3c
arm64: use x64-hosted compiler to avoid 32-bit cl.exe OOM
dwoz Nov 7, 2026
68d66ff
arm64: patch python.props to force x64-hosted compiler, env var ignored
dwoz Nov 7, 2026
0364ef7
arm64: pass /p:PreferredToolArchitecture=x64 via shell with quoting
dwoz Nov 7, 2026
b526f36
arm64: disable WPO+LTCG for ARM64 Release to dodge cl.exe pass-2 OOM
dwoz Nov 7, 2026
907f097
arm64: add /O1 + no intrinsics to pyproject.props override
dwoz Nov 7, 2026
0fbfebd
arm64: /Od + broaden ItemDefinitionGroup condition to all configs
dwoz Nov 7, 2026
6854a4f
arm64 verify: use cffi 2.0.0 for all win_arm64 branches, not just 3.14
dwoz Nov 7, 2026
47f9508
arm64 CI labels: drop redundant "arm64" suffix from job name
dwoz Nov 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/build-native-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,92 @@ jobs:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-win.tar.xz
path: build/${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-win.tar.xz
retention-days: 5

build_windows_arm64:
name: "Python Windows"
# Native build: host and target are both arm64, so this runs on the
# windows-11-arm hosted runner rather than cross-compiling from the
# x64 windows-2022 image build_windows uses. WIP job for
# https://github.com/saltstack/relenv/issues/280 -- untested until a
# CI run actually exercises it; expect early iterations to surface
# missing toolchain/SDK pieces the way build_windows's history did.
runs-on: windows-11-arm
strategy:
fail-fast: false
matrix:
version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- arm64
env:
RELENV_DATA: ${{ github.workspace }}
outputs:
version: ${{ steps.python-version.outputs.version }}
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install VS Build Tools
run: |
relenv/_scripts/install_vc_build.ps1 -CICD

- name: Install ARM64 VC++ Tools
# install_vc_build.ps1 only requests the x86/x64 VCTools workload
# plus the legacy VC.140 toolset for the amd64/x86 job; it never
# asks for the ARM64 compiler/linker/armasm64, so request that
# component explicitly here rather than assuming the runner
# image's pre-installed VS carries it.
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * -property installationPath
$installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe"
& $installer modify --installPath "$vsPath" `
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
--quiet --norestart --nocache
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: Install nox
run: |
pip3 install nox

- name: Determine Python Version
id: python-version
run: |
echo "version=$(python3 -m relenv versions --version=${{ matrix.version }})" | tee -a "$env:GITHUB_OUTPUT"

- name: Build Python with Relenv
env:
RELENV_NATIVE_PY_VERSION: 3.10.15
# NOTE: the amd64/x86 job pins WindowsTargetPlatformVersion to
# 10.0.19041.0 so MSBuild pairs with the v140 toolset (newer
# SDKs' SSE intrinsics break under v140). Arm64 never uses
# v140 (v140 has no arm64 code generator), so leave the SDK
# version unpinned here: the windows-11-arm runner ships VS 18
# with Win11 SDK 26100 and does not have 10.0.19041.0 available.
HOST_PYTHON: ${{ steps.setup-python.outputs.python-path }}
run: |
python -m relenv build --no-pretty --arch=${{ matrix.arch }} --python=${{ steps.python-version.outputs.version }}

- name: Upload Build Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-windows-logs
path: logs/*
retention-days: 5

- name: Upload Zipfile
uses: actions/upload-artifact@v4
with:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-win.tar.xz
path: build/${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-win.tar.xz
retention-days: 5
68 changes: 68 additions & 0 deletions .github/workflows/verify-build-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,71 @@ jobs:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-windows-logs
path: logs/*
retention-days: 5

test_windows_arm64:
name: "Verify Windows"
# Matches build_windows_arm64's native windows-11-arm runner in
# build-native-action.yml. WIP for
# https://github.com/saltstack/relenv/issues/280.
runs-on: windows-11-arm

strategy:
fail-fast: false
matrix:
version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- arm64

outputs:
version: ${{ steps.python-version.outputs.version }}
env:
RELENV_DATA: ${{ github.workspace }}

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
# 3.10, unlike the x64 job, has no official arm64 Windows build
# for setup-python to install ("The version '3.10' with
# architecture 'arm64' was not found for Windows Enterprise") --
# CPython's arm64 Windows installers only started at 3.11. Use
# the same bootstrap version build_windows_arm64 already uses.
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install VS Build Tools
run: |
relenv/_scripts/install_vc_build.ps1 -CICD

- name: Install nox
run: |
pip3 install nox

- name: Determine Python Version
id: python-version
run: |
echo "version=$(python3 -m relenv versions --version=${{ matrix.version }})" | tee -a "$env:GITHUB_OUTPUT"

- name: "Download artifact: build/${{ matrix.version }}-${{ matrix.arch }}-win.tar.xz"
uses: actions/download-artifact@v4
with:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-win.tar.xz
path: build/

- name: Verify Build
run: |
nox -e tests -- tests/test_verify_build.py

- name: Upload Build Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ steps.python-version.outputs.version }}-${{ matrix.arch }}-windows-logs
path: logs/*
retention-days: 5
71 changes: 65 additions & 6 deletions relenv/_scripts/install_vc_build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,38 @@ function Write-Result($result, $ForegroundColor="Green") {
}
}

function Test-V140Installed {
# The v140 PlatformToolset lives in one of two places depending on the
# VS installer generation:
#
# * VS 2017 / VS 2019 and earlier shared MSBuild writes to the legacy
# shared location under ``${env:ProgramFiles(x86)}\MSBuild``.
# * VS 2022 17.14+ / VS 18 moved MSBuild inside the per-install tree
# and populates only ``<VS_INST_LOC>\MSBuild\Microsoft\VC\<vXXX>\
# Platforms\<Arch>\PlatformToolsets\v140`` -- the legacy path stays
# empty even when v140 is installed and usable.
#
# Return $true on the first match.
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[String] $VSInstLoc
)
if ( Test-Path -Path "${env:ProgramFiles(x86)}\MSBuild\Microsoft.Cpp\v4.0\V140" ) {
return $true
}
if ( $VSInstLoc ) {
$hit = Get-ChildItem `
-Path "$VSInstLoc\MSBuild\Microsoft\VC\*\Platforms\*\PlatformToolsets\v140" `
-ErrorAction SilentlyContinue |
Select-Object -First 1
if ( $hit ) {
return $true
}
}
return $false
}

function Add-Certificate {
[CmdletBinding()]
param(
Expand Down Expand Up @@ -97,8 +129,23 @@ try {
$VS_INST_LOC = $(Get-CimInstance MSFT_VSInstance -Namespace root/cimv2/vs).InstallLocation
$MSBUILD_BIN = $(Get-ChildItem "$VS_INST_LOC\MSBuild\*\Bin\msbuild.exe").FullName
} catch {
# If VS is not installed, this is the fallback for this installation
$MSBUILD_BIN = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe"
# The MSFT_VSInstance CIM class isn't registered on every runner image
# (confirmed absent on windows-11-arm even though VS 2022 ships
# pre-installed there) -- before assuming VS needs to be installed
# from scratch, fall back to vswhere.exe, which is present on every
# GitHub-hosted Windows image regardless of CIM provider support.
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$VS_INST_LOC = $null
if ( Test-Path -Path $vswhere ) {
$VS_INST_LOC = & $vswhere -latest -products * -property installationPath
}
if ( $VS_INST_LOC ) {
$MSBUILD_BIN = $(Get-ChildItem "$VS_INST_LOC\MSBuild\*\Bin\msbuild.exe").FullName
} else {
# Genuinely no VS install found by either method - this is the
# fallback for a from-scratch installation.
$MSBUILD_BIN = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe"
}
}

#-------------------------------------------------------------------------------
Expand All @@ -115,10 +162,22 @@ if ( Test-Path -Path $MSBUILD_BIN ) {
# without v140 by default, so use the VS bootstrapper to add the
# component to the existing install. We don't trust the installer's
# exit code (it returns non-zero in a few benign cases) — instead
# verify the v140 platform-toolset targets file exists afterwards.
$V140_TARGETS = "${env:ProgramFiles(x86)}\MSBuild\Microsoft.Cpp\v4.0\V140"
# verify the v140 platform-toolset targets exist afterwards. Check
# both the legacy shared-MSBuild location and the VS 2022 17.14+ /
# VS 18 per-install location (see Test-V140Installed above).
#
# Skip v140 entirely on arm64 hosts: v140 cannot generate arm64 code
# (VS 2015 predates the arm64 toolchain), and the windows-11-arm
# runner image ships VS 18 / VS Enterprise 2026, whose product graph
# does not expose Microsoft.VisualStudio.Component.VC.140 at all —
# the bootstrapper logs "Cannot find package ... in product graph"
# and exits 0, which then fails the post-install verify. Python
# 3.10/3.11 PCbuild on arm64 falls through python.props to whatever
# toolset VS has (v143/v144), which supports arm64 natively.
Write-Host "Ensuring v140 toolset is installed: " -NoNewline
if ( Test-Path -Path $V140_TARGETS ) {
if ( $env:PROCESSOR_ARCHITECTURE -eq "ARM64" ) {
Write-Result "Skipped (arm64 host; v140 does not support arm64)" -ForegroundColor Green
} elseif ( Test-V140Installed -VSInstLoc $VS_INST_LOC ) {
Write-Result "Already present" -ForegroundColor Green
} else {
Write-Host ""
Expand Down Expand Up @@ -151,7 +210,7 @@ if ( Test-Path -Path $MSBUILD_BIN ) {
-PassThru -Wait -NoNewWindow
Write-Host " bootstrapper exit code: $($proc.ExitCode)"
Write-Host "Verifying v140 toolset: " -NoNewline
if ( Test-Path -Path $V140_TARGETS ) {
if ( Test-V140Installed -VSInstLoc $VS_INST_LOC ) {
Write-Result "Success" -ForegroundColor Green
} else {
Write-Result "Failed (v140 still not registered with MSBuild)" -ForegroundColor Red
Expand Down
Loading