mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-11-26 03:53:17 +08:00
## Why
The shared pytest shard count limits Linux and Windows to two shards to
accommodate macOS's five-runner concurrency limit. Linux and Windows can
each use a third pytest shard while macOS keeps two pytest shards
alongside its three Playwright shards. A Windows run also exposed an
existing autostart test that required mocked startup to finish within 50
ms of real time.
## How
Define six workflow variables, one for each suite and operating system,
and pass them to the matrix generator as required counts. Configure
pytest as Linux 3, Windows 3, and macOS 2, with three Playwright shards
on each OS. This produces 17 test jobs, including five macOS jobs.
Validate each count and preserve complete shard coverage and the stable
required summary checks.
Use the existing fake clock in the autostart deadline test to simulate
waiting longer than the startup budget for the startup lock. Verify that
startup receives a fresh budget after acquisition, keeping the other
owner-lock checks real.
<!-- greptile_comment -->
<!-- greptile_summary -->
<h2><a
href="https://app.greptile.com/api/retrigger?id=87502819"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/alishahryar1/github/Alishahryar1/free-claude-code/-/pull/2174"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>
<!-- greptile-impact-verdict --> No identified findings block merging
these changes.
<details open><summary><h3>Summary</h3></summary>
The PR gives each operating system separate pytest and Playwright shard
counts.
- CI runs different shard counts on each operating system.
- The autostart deadline test simulates lock waiting with a fake clock.
There are no identified blocking findings.
</details>
<!-- greptile_confidence_score:5 -->
<sub>Reviews (2) · Last reviewed commit: ["Make startup budget test
independent of
..."](9f19469538)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=alishahryar1/free-claude-code)</sub>
<!-- /greptile_comment -->
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
"""Generate GitHub Actions test matrices from the workflow's shard counts.
|
|
|
|
To replay a shard locally, set PYTEST_ADDOPTS to
|
|
"--splits 5 --group 2 --splitting-algorithm=least_duration" and run the
|
|
pytest or playwright check through scripts/ci.ps1 or scripts/ci.sh.
|
|
"""
|
|
|
|
import argparse
|
|
import json
|
|
|
|
RUNNERS = {
|
|
"Linux": "ubuntu-latest",
|
|
"Windows": "windows-latest",
|
|
"macOS": "macos-latest",
|
|
}
|
|
MAX_SHARDS = 256 // len(RUNNERS)
|
|
|
|
|
|
def shard_count(value: str) -> int:
|
|
count = int(value)
|
|
if not 1 <= count <= MAX_SHARDS:
|
|
raise argparse.ArgumentTypeError(f"must be between 1 and {MAX_SHARDS}")
|
|
return count
|
|
|
|
|
|
def matrix(counts: dict[str, int]) -> dict[str, list[dict[str, str | int]]]:
|
|
return {
|
|
"include": [
|
|
{"os": os_name, "runner": runner, "shard": shard, "shards": counts[os_name]}
|
|
for os_name, runner in RUNNERS.items()
|
|
for shard in range(1, counts[os_name] + 1)
|
|
]
|
|
}
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
for suite in ("pytest", "playwright"):
|
|
for os_name in RUNNERS:
|
|
parser.add_argument(
|
|
f"--{suite}-{os_name.lower()}-shards", required=True, type=shard_count
|
|
)
|
|
args = parser.parse_args()
|
|
for suite in ("pytest", "playwright"):
|
|
counts = {
|
|
os_name: getattr(args, f"{suite}_{os_name.lower()}_shards")
|
|
for os_name in RUNNERS
|
|
}
|
|
print(f"{suite}_matrix={json.dumps(matrix(counts), separators=(',', ':'))}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|