Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ max_line_length = 88 # Same as Ruff's default
[*.md]
trim_trailing_whitespace = false

[*.{yaml,yml,json,toml,clang-format}]
[*.{yaml,yml,json,toml,clang-format,vcxproj}]
indent_size = 2
44 changes: 29 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ env:
jobs:
test:
name: Build and test
runs-on: windows-2019
timeout-minutes: 20
runs-on: windows-2022
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64", "x86"]
architecture: [x64, x86]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -65,12 +65,26 @@ jobs:
# Compilation and registration of the PyCOMTest server dll
- name: Set up MSVC
uses: microsoft/setup-msbuild@v2

# See https://github.com/actions/runner-images/issues/9701
# Adapted from https://github.com/actions/runner-images/issues/9873#issuecomment-2139288682
- name: Install missing Visual Studio components
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$VsInstallPath = vswhere.exe -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
[string]$ComponentsToAdd = @(
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"
Copy link
Collaborator Author

@Avasam Avasam Apr 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to get info about the CI's VS and MSVC versions and this is what I got using vswhere -latest
https://github.com/mhammond/pywin32/actions/runs/14687605417/job/41218346703?pr=2582#step:6:6

$VS_PATH = vswhere.exe -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
echo "VS_PATH=$VS_PATH" >> $env:GITHUB_ENV
echo "MSVC_VERSION=$(((Get-Content "$VS_PATH\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt") -split '\.')[0..1] -join '.')" >> $env:GITHUB_ENV
echo "VS_VERSION=$(((vswhere.exe -latest -property installationVersion) -split '\.')[0..1] -join '.')" >> $env:GITHUB_ENV

Results in:

VS_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
MSVC_VERSION: 14.43
VS_VERSION: 17.13

Which is completely different than the 14.29 and 16.11 needed here. That's why I hardcoded this component version number.

) | ForEach-Object {"--add $_"}
$ArgumentList = ('modify', '--installPath', "`"$VsInstallPath`"", $ComponentsToAdd, '--quiet', '--norestart', '--nocache')
echo "vs_installer.exe $($ArgumentList -join ' ')"
# should be run twice for some reason
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find an explanation in any of the linked issues as to why we need to run this twice. But I confirmed it's needed. It sure doesn't help with the extra time it takes.


- name: Build and register the PyCOMTest server dll
run: |
cd com/TestSources/PyCOMTest
msbuild .\PyCOMTest.sln -property:Configuration=Release
cd x64/Release
regsvr32 .\PyCOMTest.dll
msbuild com/TestSources/PyCOMTest/PyCOMTest.sln -property:Configuration=Release
regsvr32 com/TestSources/PyCOMTest/x64/Release/PyCOMTest.dll

- name: Run tests
# Run the tests directly from the source dir so support files (eg, .wav files etc)
Expand All @@ -92,8 +106,8 @@ jobs:
# Later, when available, we can add tests using this wheel on ARM64 VMs
build_arm64:
name: Cross-compile ARM
runs-on: windows-2019
timeout-minutes: 20
runs-on: windows-2022
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -141,8 +155,8 @@ jobs:

# This job can be run locally by running `pre-commit run`
checkers:
runs-on: windows-2019
timeout-minutes: 20
runs-on: windows-2022
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -173,8 +187,8 @@ jobs:
if: ${{ !cancelled() }}

mypy:
runs-on: windows-2019
timeout-minutes: 20
runs-on: windows-2022
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
Expand All @@ -191,8 +205,8 @@ jobs:
- run: mypy . --python-version=${{ matrix.python-version }}

pyright:
runs-on: windows-2019
timeout-minutes: 20
runs-on: windows-2022
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 3 additions & 1 deletion com/TestSources/PyCOMTest/PyCOMTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{8EB3046C-6CE8-4537-9B58-6EDD46E6D632}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
<!-- Target Windows Server 2022 which GitHub Actions run on -->
<!-- https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#windows-server-2022 -->
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down