Skip to content
Merged
Changes from 2 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
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
Loading