ci: add GitHub Actions workflow for unit tests#47
Open
hashwnath wants to merge 1 commit into
Open
Conversation
Adds .github/workflows/ci.yml that runs pytest tests/unit/ on every push and pull request to main. - Tests Python 3.10, 3.11, 3.12, 3.13 on ubuntu-latest - Adds a windows-latest smoke test on 3.13 to guard against platform-specific issues (non-UTF-8 stdout, missing /bin/bash) - Pins both actions to full SHA digests for supply-chain integrity - Caches pip downloads via setup-python built-in cache (keyed on pyproject.toml hash) - Restricts GITHUB_TOKEN to contents: read (OSSF Scorecard compliance) - Cancels in-progress runs when a new commit is pushed to the same branch/PR - 10-minute job timeout to prevent runaway jobs - No Playwright browser install needed: all 16 unit tests pass without browser binaries (confirmed locally) Also declares pytest>=7.4 as a [dev] optional dependency in pyproject.toml so `pip install -e ".[dev]"` resolves the test runner cleanly without a bare unpinned pip install. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Webwright has no CI today.
tests/unit/already contains 16 unit tests across two files, but they are never exercised automatically. Without CI, regressions can land silently — especially as contributor volume grows (300+ forks, multiple open PRs in flight).What this workflow does
pytest tests/unit/ -v --tb=shorton every push tomainand every pull request targetingmainubuntu-latestwindows-latestsmoke test (Python 3.13) to guard against platform-specific issues — relevant to the open Windows bugs (playwright_patterns.md 'Browser launch skeleton' crashes with UnicodeEncodeError on Windows when aria_snapshot output contains non-cp1252 characters #7 UnicodeEncodeError, fix: skip bash syntax validation on Windows #30/bin/bash -nnot found)setup-python's built-in cache key (hashed onpyproject.toml) — saves ~20 s per matrix leg on warm cacheconcurrency:block)GITHUB_TOKENtocontents: read— satisfies OSSF Scorecard "Token-Permissions" checktimeout-minutesto prevent runaway jobsWhat it intentionally does NOT do
playwright install chromium— all 16 current unit tests are pure-Python.check_screenshot()and friends gracefully return(False, "message")when no browser binary is installed. Confirmed locally: 16/16 pass with onlypip install -e ".[dev]".ruff/flake8config exists yet; that is a separate discussion. ATODOcomment is left in the workflow.README.md— badge snippet below for optional use.pyproject.toml change
Adds a
[project.optional-dependencies]section withdev = ["pytest>=7.4"]sopip install -e ".[dev]"resolves the test runner without a bare unpinnedpip install pytest. This is a 2-line addition.Verified locally
All 16 tests pass on Python 3.11 without Playwright browser binaries.
Optional README badge