Skip to content

Commit 22b2594

Browse files
committed
Native ARM64 CI tests and wheels
1 parent 8258348 commit 22b2594

File tree

2 files changed

+49
-33
lines changed

2 files changed

+49
-33
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@ env:
1717
jobs:
1818
test:
1919
name: Build and test
20-
runs-on: windows-2019
21-
timeout-minutes: 20
20+
runs-on: ${{ matrix.os }}
21+
timeout-minutes: 25
2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
26-
architecture: ["x64", "x86"]
26+
# CPython has no ARM distribution until 3.11
27+
python-architecture: [x64, x86]
28+
os: [windows-2019, windows-11-arm]
29+
exclude:
30+
- os: windows-11-arm
31+
python-architecture: x86
32+
# python-architecture: [x64, x86, arm64]
33+
# include:
34+
# - python-architecture: arm64
35+
# os: windows-11-arm
36+
# - os: windows-2019
2737

2838
steps:
2939
- uses: actions/checkout@v4
@@ -32,13 +42,13 @@ jobs:
3242
uses: actions/setup-python@v5
3343
with:
3444
python-version: ${{ matrix.python-version }}
35-
architecture: ${{ matrix.architecture }}
45+
architecture: ${{ matrix.python-architecture }}
3646
cache: pip
3747
cache-dependency-path: .github/workflows/main.yml
3848
check-latest: true
3949

4050
- name: Fix user Scripts missing from PATH
41-
if: matrix.architecture == 'x86'
51+
if: matrix.python-architecture == 'x86'
4252
run: |
4353
# Work around https://github.com/actions/setup-python/issues/1005
4454
$ScriptsPath = python -c "import sysconfig,os; print(sysconfig.get_path('scripts', f'{os.name}_user'))"
@@ -65,12 +75,28 @@ jobs:
6575
# Compilation and registration of the PyCOMTest server dll
6676
- name: Set up MSVC
6777
uses: microsoft/setup-msbuild@v2
78+
79+
# See https://github.com/actions/runner-images/issues/9701
80+
# Adapted from https://github.com/actions/runner-images/issues/9873#issuecomment-2139288682
81+
- name: Install missing Visual Studio components
82+
if: matrix.os != 'windows-2019' # Only an issue on newer versions of Windows
83+
run: |
84+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
85+
$VsInstallPath = vswhere.exe -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
86+
[string]$ComponentsToAdd = @(
87+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"
88+
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64"
89+
) | ForEach-Object {"--add $_"}
90+
$ArgumentList = ('modify', '--installPath', "`"$VsInstallPath`"", $ComponentsToAdd, '--quiet', '--norestart', '--nocache')
91+
echo "vs_installer.exe $($ArgumentList -join ' ')"
92+
# should be run twice for some reason
93+
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
94+
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
95+
6896
- name: Build and register the PyCOMTest server dll
6997
run: |
70-
cd com/TestSources/PyCOMTest
71-
msbuild .\PyCOMTest.sln -property:Configuration=Release
72-
cd x64/Release
73-
regsvr32 .\PyCOMTest.dll
98+
msbuild com/TestSources/PyCOMTest/PyCOMTest.sln -property:Configuration=Release
99+
regsvr32 com/TestSources/PyCOMTest/x64/Release/PyCOMTest.dll
74100
75101
- name: Run tests
76102
# Run the tests directly from the source dir so support files (eg, .wav files etc)
@@ -84,28 +110,23 @@ jobs:
84110
# Upload artifacts even if tests fail
85111
if: ${{ always() }}
86112
with:
87-
name: artifacts-${{ matrix.python-version }}-${{ matrix.architecture }}
113+
name: artifacts-${{ matrix.python-version }}-${{ matrix.python-architecture }}-${{ matrix.os }}
88114
path: dist/*.whl
89115
if-no-files-found: error
90116

91-
# We cannot build and test on ARM64, so we cross-compile.
92-
# Later, when available, we can add tests using this wheel on ARM64 VMs
93-
build_arm64:
117+
# Do a single ARM64 cross-compilation to ensure we still support it
118+
test_cross_compile:
94119
name: Cross-compile ARM
95120
runs-on: windows-2019
96-
timeout-minutes: 20
97-
strategy:
98-
fail-fast: false
99-
matrix:
100-
python-version: ["3.10", "3.11", "3.12", "3.13"]
121+
timeout-minutes: 25
101122
steps:
102123
- uses: actions/checkout@v4
103124

104-
- name: Set up Python ${{ matrix.python-version }}
125+
- name: Set up latest stable Python
105126
uses: actions/setup-python@v5
106127
with:
107-
python-version: ${{ matrix.python-version }}
108-
architecture: "x64"
128+
python-version: 3.x
129+
architecture: x64
109130
cache: pip
110131
cache-dependency-path: .github/workflows/main.yml
111132
check-latest: true
@@ -119,15 +140,9 @@ jobs:
119140
- name: Build wheels
120141
run: python -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=-L.\arm64libs --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
121142

122-
- uses: actions/upload-artifact@v4
123-
with:
124-
name: artifacts-${{ matrix.python-version }}-arm64
125-
path: dist/*.whl
126-
if-no-files-found: error
127-
128143
merge:
129144
runs-on: windows-latest
130-
needs: [test, build_arm64]
145+
needs: [test]
131146
steps:
132147
- name: Merge Artifacts
133148
uses: actions/upload-artifact/merge@v4
@@ -142,7 +157,7 @@ jobs:
142157
# This job can be run locally by running `pre-commit run`
143158
checkers:
144159
runs-on: windows-2019
145-
timeout-minutes: 20
160+
timeout-minutes: 25
146161
steps:
147162
- uses: actions/checkout@v4
148163
- uses: actions/setup-python@v5
@@ -157,15 +172,16 @@ jobs:
157172
with:
158173
version: "0.8.4"
159174
- run: ruff format --check
160-
- run: | # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
175+
# Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
176+
- run: |
161177
clang-format --Werror --dry-run $(git ls-files '*.cpp' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
162178
if ($LastExitCode -ne 0) { exit $LastExitCode }
163179
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
164180
if ($LastExitCode -ne 0) { exit $LastExitCode }
165181
166182
mypy:
167183
runs-on: windows-2019
168-
timeout-minutes: 20
184+
timeout-minutes: 25
169185
strategy:
170186
fail-fast: false
171187
matrix:
@@ -183,7 +199,7 @@ jobs:
183199

184200
pyright:
185201
runs-on: windows-2019
186-
timeout-minutes: 20
202+
timeout-minutes: 25
187203
strategy:
188204
fail-fast: false
189205
matrix:

make_all.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ py -3.12 -m build --wheel
2525
py -3.13-32 -m build --wheel
2626
py -3.13 -m build --wheel
2727

28-
rem Check /build_env.md#build-environment to make sure you have all the required ARM64 components installed
28+
rem Check /build_env.md#cross-compiling-for-arm64-microsoft-visual-c-141-and-up to make sure you have all the required ARM64 components installed
2929
py -3.10 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
3030
py -3.11 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
3131
py -3.12 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64

0 commit comments

Comments
 (0)