diff --git a/.editorconfig b/.editorconfig index e55d13f9d6..773e887a6b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/install-vs-components.py b/.github/workflows/install-vs-components.py new file mode 100644 index 0000000000..ed2deb62f7 --- /dev/null +++ b/.github/workflows/install-vs-components.py @@ -0,0 +1,44 @@ +# See https://github.com/actions/runner-images/issues/9701 +# Adapted from https://github.com/actions/runner-images/issues/9873#issuecomment-2139288682 + +import os +import platform +from itertools import chain +from subprocess import check_call, check_output + +os.chdir("C:/Program Files (x86)/Microsoft Visual Studio/Installer") +vs_install_path = check_output( + ( + "vswhere.exe", + "-latest", + "-products", + "*", + "-requires", + "Microsoft.Component.MSBuild", + "-property", + "installationPath", + ), + text=True, + shell=True, +).strip() +components_to_add = ( + ["Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64"] + if platform.machine() == "ARM64" + else ["Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"] +) +args = ( + "vs_installer.exe", + "modify", + "--installPath", + vs_install_path, + *chain.from_iterable([("--add", component) for component in components_to_add]), + "--quiet", + "--norestart", +) +print(*args) + +# Should be run twice for some reason +print("First run...") +check_call(args) +print("Second run...") +check_call(args) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7aa7724efc..e03b0c0db0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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", "3.14-dev"] - architecture: ["x64", "x86"] + architecture: [x64, x86] steps: - uses: actions/checkout@v4 @@ -63,14 +63,16 @@ jobs: pywin32_postinstall -remove -destination "$UserSite" # Compilation and registration of the PyCOMTest server dll - - name: Set up MSVC + - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 + + - name: Install missing Visual Studio components + run: python .github\workflows\install-vs-components.py + - 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) @@ -92,8 +94,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: @@ -142,8 +144,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 @@ -174,8 +176,8 @@ jobs: if: ${{ !cancelled() }} mypy: - runs-on: windows-2019 - timeout-minutes: 20 + runs-on: windows-2022 + timeout-minutes: 25 strategy: fail-fast: false matrix: @@ -192,8 +194,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: diff --git a/com/TestSources/PyCOMTest/PyCOMTest.vcxproj b/com/TestSources/PyCOMTest/PyCOMTest.vcxproj index 107b6caa14..050d0f6b60 100644 --- a/com/TestSources/PyCOMTest/PyCOMTest.vcxproj +++ b/com/TestSources/PyCOMTest/PyCOMTest.vcxproj @@ -22,7 +22,9 @@ 17.0 {8EB3046C-6CE8-4537-9B58-6EDD46E6D632} Win32Proj - 10.0.22000.0 + + + 10.0.20348.0 diff --git a/setup.py b/setup.py index 8a8928988f..4e61136bbd 100644 --- a/setup.py +++ b/setup.py @@ -145,7 +145,7 @@ def __init__( # CRYPT_DECRYPT_MESSAGE_PARA.dwflags is in an ifdef for some unknown reason # See github PR #1444 for more details... ("CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS", None), - # Minimum Windows version supported (Windows 7 / Windows Server 2008) + # Minimum Windows version supported (Windows 7) # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt ("_WIN32_WINNT", hex(0x0601)), ("WINVER", hex(0x0601)),