Skip to content

Commit 0507672

Browse files
authored
Update to Windows 2022 runner image (#2582)
* Update to Windows 2022 runner image * Retarget PyCOMTest to Windows Server 2022 * Remove incorrect mention of Windows Server 2008
1 parent 420e4a5 commit 0507672

File tree

5 files changed

+67
-19
lines changed

5 files changed

+67
-19
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ max_line_length = 88 # Same as Ruff's default
1414
[*.md]
1515
trim_trailing_whitespace = false
1616
17-
[*.{yaml,yml,json,toml,clang-format}]
17+
[*.{yaml,yml,json,toml,clang-format,vcxproj}]
1818
indent_size = 2
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://github.com/actions/runner-images/issues/9701
2+
# Adapted from https://github.com/actions/runner-images/issues/9873#issuecomment-2139288682
3+
4+
import os
5+
import platform
6+
from itertools import chain
7+
from subprocess import check_call, check_output
8+
9+
os.chdir("C:/Program Files (x86)/Microsoft Visual Studio/Installer")
10+
vs_install_path = check_output(
11+
(
12+
"vswhere.exe",
13+
"-latest",
14+
"-products",
15+
"*",
16+
"-requires",
17+
"Microsoft.Component.MSBuild",
18+
"-property",
19+
"installationPath",
20+
),
21+
text=True,
22+
shell=True,
23+
).strip()
24+
components_to_add = (
25+
["Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64"]
26+
if platform.machine() == "ARM64"
27+
else ["Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"]
28+
)
29+
args = (
30+
"vs_installer.exe",
31+
"modify",
32+
"--installPath",
33+
vs_install_path,
34+
*chain.from_iterable([("--add", component) for component in components_to_add]),
35+
"--quiet",
36+
"--norestart",
37+
)
38+
print(*args)
39+
40+
# Should be run twice for some reason
41+
print("First run...")
42+
check_call(args)
43+
print("Second run...")
44+
check_call(args)

.github/workflows/main.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ env:
1717
jobs:
1818
test:
1919
name: Build and test
20-
runs-on: windows-2019
21-
timeout-minutes: 20
20+
runs-on: windows-2022
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", "3.14-dev"]
26-
architecture: ["x64", "x86"]
26+
architecture: [x64, x86]
2727

2828
steps:
2929
- uses: actions/checkout@v4
@@ -63,14 +63,16 @@ jobs:
6363
pywin32_postinstall -remove -destination "$UserSite"
6464
6565
# Compilation and registration of the PyCOMTest server dll
66-
- name: Set up MSVC
66+
- name: Add msbuild to PATH
6767
uses: microsoft/setup-msbuild@v2
68+
69+
- name: Install missing Visual Studio components
70+
run: python .github\workflows\install-vs-components.py
71+
6872
- name: Build and register the PyCOMTest server dll
6973
run: |
70-
cd com/TestSources/PyCOMTest
71-
msbuild .\PyCOMTest.sln -property:Configuration=Release
72-
cd x64/Release
73-
regsvr32 .\PyCOMTest.dll
74+
msbuild com/TestSources/PyCOMTest/PyCOMTest.sln -property:Configuration=Release
75+
regsvr32 com/TestSources/PyCOMTest/x64/Release/PyCOMTest.dll
7476
7577
- name: Run tests
7678
# Run the tests directly from the source dir so support files (eg, .wav files etc)
@@ -92,8 +94,8 @@ jobs:
9294
# Later, when available, we can add tests using this wheel on ARM64 VMs
9395
build_arm64:
9496
name: Cross-compile ARM
95-
runs-on: windows-2019
96-
timeout-minutes: 20
97+
runs-on: windows-2022
98+
timeout-minutes: 25
9799
strategy:
98100
fail-fast: false
99101
matrix:
@@ -142,8 +144,8 @@ jobs:
142144

143145
# This job can be run locally by running `pre-commit run`
144146
checkers:
145-
runs-on: windows-2019
146-
timeout-minutes: 20
147+
runs-on: windows-2022
148+
timeout-minutes: 25
147149
steps:
148150
- uses: actions/checkout@v4
149151
- uses: actions/setup-python@v5
@@ -174,8 +176,8 @@ jobs:
174176
if: ${{ !cancelled() }}
175177
176178
mypy:
177-
runs-on: windows-2019
178-
timeout-minutes: 20
179+
runs-on: windows-2022
180+
timeout-minutes: 25
179181
strategy:
180182
fail-fast: false
181183
matrix:
@@ -192,8 +194,8 @@ jobs:
192194
- run: mypy . --python-version=${{ matrix.python-version }}
193195

194196
pyright:
195-
runs-on: windows-2019
196-
timeout-minutes: 20
197+
runs-on: windows-2022
198+
timeout-minutes: 25
197199
strategy:
198200
fail-fast: false
199201
matrix:

com/TestSources/PyCOMTest/PyCOMTest.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
<VCProjectVersion>17.0</VCProjectVersion>
2323
<ProjectGuid>{8EB3046C-6CE8-4537-9B58-6EDD46E6D632}</ProjectGuid>
2424
<Keyword>Win32Proj</Keyword>
25-
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
25+
<!-- Target Windows Server 2022 which GitHub Actions run on -->
26+
<!-- https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#windows-server-2022 -->
27+
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
2628
</PropertyGroup>
2729
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2830
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(
145145
# CRYPT_DECRYPT_MESSAGE_PARA.dwflags is in an ifdef for some unknown reason
146146
# See github PR #1444 for more details...
147147
("CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS", None),
148-
# Minimum Windows version supported (Windows 7 / Windows Server 2008)
148+
# Minimum Windows version supported (Windows 7)
149149
# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
150150
("_WIN32_WINNT", hex(0x0601)),
151151
("WINVER", hex(0x0601)),

0 commit comments

Comments
 (0)