-
Notifications
You must be signed in to change notification settings - Fork 10.4k
ci: add windows-latest to test matrix #2233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e06894d
ci: add windows-latest to test matrix
mnriem c27cc0e
test: skip bash-specific tests on Windows
mnriem de8260b
test: fix 3 Windows-specific test failures
mnriem daf6986
test: extract requires_bash marker and fix PS test skip
mnriem 25b6aff
test: use runtime bash check instead of platform check
mnriem 5df27f1
test: reject WSL bash, accept only MSYS/MINGW on Windows
mnriem db8134d
ci: add comment explaining Windows bash test behavior
mnriem ca70454
test: early-reject WSL launcher, fix remaining f-string JSON
mnriem f71ce48
test: use bare 'bash' for detection to match test invocation
mnriem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,68 @@ | ||
| """Shared test helpers for the Spec Kit test suite.""" | ||
|
|
||
| import os | ||
| import re | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
|
|
||
| import pytest | ||
|
|
||
| _ANSI_ESCAPE_RE = re.compile(r"\x1b\[[0-?]*[ -/]*[@-~]") | ||
|
|
||
|
|
||
| def _has_working_bash() -> bool: | ||
| """Check whether a functional native bash is available. | ||
|
|
||
| On Windows, ``subprocess.run(["bash", ...])`` uses CreateProcess, | ||
| which searches System32 *before* PATH — so it may find the WSL | ||
| launcher even when Git-for-Windows bash appears first in PATH via | ||
| ``shutil.which``. We therefore probe with bare ``"bash"`` (the | ||
| same way test helpers invoke it) to get an accurate result. | ||
|
|
||
| On Windows, only Git-for-Windows bash (MSYS2/MINGW) is accepted. | ||
| The WSL launcher is rejected because it runs in a separate Linux | ||
| filesystem and cannot handle native Windows paths used by the | ||
| test fixtures. | ||
|
|
||
| Set SPECKIT_TEST_BASH=1 to force-enable bash tests regardless. | ||
| """ | ||
| if os.environ.get("SPECKIT_TEST_BASH") == "1": | ||
| return True | ||
| if shutil.which("bash") is None: | ||
| return False | ||
| # Probe with bare "bash" — same as the test helpers — so that | ||
| # Windows CreateProcess resolution order is respected. | ||
| try: | ||
| r = subprocess.run( | ||
| ["bash", "-c", "echo ok"], | ||
| capture_output=True, text=True, timeout=5, | ||
| ) | ||
| if r.returncode != 0 or "ok" not in r.stdout: | ||
| return False | ||
| except (OSError, subprocess.TimeoutExpired): | ||
| return False | ||
| # On Windows, verify we have MSYS/MINGW bash (Git for Windows), | ||
| # not the WSL launcher which can't handle native paths. | ||
| if sys.platform == "win32": | ||
| try: | ||
| u = subprocess.run( | ||
| ["bash", "-c", "uname -s"], | ||
| capture_output=True, text=True, timeout=5, | ||
| ) | ||
| kernel = u.stdout.strip().upper() | ||
| if not any(k in kernel for k in ("MSYS", "MINGW", "CYGWIN")): | ||
| return False | ||
| except (OSError, subprocess.TimeoutExpired): | ||
| return False | ||
| return True | ||
|
|
||
|
|
||
| requires_bash = pytest.mark.skipif( | ||
| not _has_working_bash(), reason="working bash not available" | ||
| ) | ||
|
|
||
|
|
||
| def strip_ansi(text: str) -> str: | ||
| """Remove ANSI escape codes from Rich-formatted CLI output.""" | ||
| return _ANSI_ESCAPE_RE.sub("", text) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.