Fix Windows CI and update Python version support#131
Conversation
- Replace $? with $LASTEXITCODE for proper exit code capture - Fix inverted test logic: cmake_good should fail when exit code != 0, cmake_bad should fail when exit code == 0 - Add exit code to error message for easier debugging $? in PowerShell is a boolean (True/False), not the actual exit code. The correct way to capture external program exit codes is $LASTEXITCODE.
The Chocolatey cppcheck package is broken - it was compiled with a hardcoded FILESDIR path that doesn't exist on GitHub Actions runners: "Failed to load std.cfg. The Cppcheck binary was compiled with FILESDIR set to R:/winlibs64ucrt_stage/inst_cppcheck-2.14.0/share/Cppcheck" The official cppcheck project marks the Chocolatey package as outdated and recommends using Scoop instead. This change: - Installs cppcheck via Scoop instead of Chocolatey - Adds Scoop shims directory to PATH for the job
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 604 604
Branches 114 101 -13
=========================================
Hits 604 604 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
- Drop support for Python 3.8 and 3.9 (end-of-life) - Add support for Python 3.13 - Minimum required Python version is now 3.10 - Update ruff target-version to py310 - Fix Windows CI: use pip cppcheck wheel instead of broken Chocolatey package (Strawberry Perl's bundled cppcheck was being picked up instead of scoop's)
The PROFILE was running Enter-VsDevShell in every PowerShell step, resetting PATH each time and overriding the Python set by setup-python. Now VsDevShell setup only runs in the Prepare env step itself.
…hell The ilammy/msvc-dev-cmd action already sets up MSVC environment and exports it to GITHUB_ENV before setup-python runs. The manual Enter-VsDevShell call was redundant and caused PATH conflicts.
The Update-SessionEnvironment call from chocolatey was overwriting MSVC environment variables set by ilammy/msvc-dev-cmd. By moving the MSVC dev command step after chocolatey packages are installed, we ensure the MSVC environment persists to subsequent steps. Co-authored-by: Claude <noreply@anthropic.com>
* Fix Windows CI: restore Python PATH after MSVC setup The ilammy/msvc-dev-cmd action runs vcvarsall.bat which prepends Visual Studio paths to PATH. VS 2022 includes a bundled Python 3.9, which then takes precedence over the Python 3.10+ set up by actions/setup-python. This caused pre-commit to use Python 3.9 when installing the cmake-pre-commit-hooks package, which fails because the package requires Python 3.10+. Fix by adding a step after msvc-dev-cmd that writes the correct Python path to GITHUB_PATH, ensuring it's prepended in subsequent steps. * Add debugging for Windows Python PATH verification Add a step to verify which Python and pre-commit are being used after the PATH restoration to help diagnose CI failures. * Fix Windows CI: ensure python3 points to correct Python Pre-commit looks for 'python3' when creating virtualenvs for hooks. After MSVC dev cmd runs, 'python3' might point to VS's bundled Python 3.9 instead of the Python 3.10+ from actions/setup-python. This fix: 1. Creates python3.exe as a copy of python.exe if it doesn't exist 2. Uses a fresh PRE_COMMIT_HOME to avoid cached environments 3. Adds detailed PATH debugging to diagnose issues * Fix Windows CI: restore Python PATH after Update-SessionEnvironment The chocolatey Update-SessionEnvironment command resets PATH from system environment variables, which overwrites the Python path set by actions/setup-python. This caused pip to install packages into Python 3.9.13 (system Python) instead of Python 3.12.10. Fix by explicitly restoring pythonLocation to PATH immediately after Update-SessionEnvironment, before running pip install. * Remove debugging code from Windows CI --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Changes
1. Fix PowerShell exit code handling (
tests/run_tests.ps1)$?with$LASTEXITCODEfor proper exit code capturecmake_goodshould fail when exit code != 0,cmake_badshould fail when exit code == 0$?in PowerShell is a boolean (True/False), not the actual exit code. The correct way to capture external program exit codes is$LASTEXITCODE.2. Fix broken cppcheck installation (
.github/workflows/ci.yml)The Chocolatey cppcheck package was compiled with a hardcoded
FILESDIRpath that doesn't exist on GitHub Actions runners. Additionally, Strawberry Perl (pre-installed on Windows runners) bundles a broken cppcheck that was being picked up.Fix: Use the
cppcheckpip wheel package which works correctly.3. Update Python version support
Test plan