Skip to content

Run the unit test suite in GitHub Actions - #33

Open
dmccoystephenson wants to merge 1 commit into
mainfrom
feature/ci-unit-tests
Open

dmccoystephenson wants to merge 1 commit into
mainfrom
feature/ci-unit-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • A Tests GitHub Actions workflow is added at .github/workflows/tests.yml. It runs on pull requests targeting main and on pushes to main, installs pygame on Python 3.12, syntax-checks the top-level modules with py_compile, and runs python -m unittest discover -s tests.
  • The repository is checked out without the Viron submodule, as proposed in Add CI to run the unit test suite on pull requests #17: the suite stubs Viron in sys.modules, so the submodule is not needed.
  • The push trigger on main goes beyond the issue's pull-request-only proposal. It is included so that main accumulates a run history against which PR results can be compared. It can be dropped if unwanted.
  • The py_compile list differs from the one in Add CI to run the unit test suite on pull requests #17: render_window_example.py no longer exists in the tree, and headless_run.py, usage_reporting.py and trace_client.py, which have been added since, are included.
  • README.md ("Running the tests") now mentions the workflow.

Closes #17

Test plan

  • python3 -m unittest discover -s tests run locally (Python 3.8.10): Ran 106 tests, OK
  • python3 -m py_compile main.py graphik.py __init__.py render_window.py headless_run.py usage_reporting.py trace_client.py passes locally
  • The workflow file parses as YAML
  • The workflow's first run on this PR is green (the workflow has never run before, so this run is its first real validation)

Merge note

.github/workflows/* is on this loop's do-not-auto-merge list, and #17 itself anticipates human review. This PR is therefore left open for the owner to merge; it is not auto-merged.

Deferred issues

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Adds a Tests workflow that installs pygame, syntax-checks the top-level
modules and runs `python -m unittest discover -s tests` on pull requests
to main and pushes to main. The Viron submodule is not checked out, as the
suite stubs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (the anchor is the workflow's own first run: https://github.com/Preponderous-Software/patchwork/actions/runs/36685845233 — pygame-2.6.1 installed, Ran 106 tests in 21.619s, OK on Python 3.12; the same 106 were also run locally on Python 3.8.10, OK):

  • Scope: PASS, with one judgment call. Only .github/workflows/tests.yml (new) and one README paragraph are changed. The push: branches: [main] trigger goes beyond Add CI to run the unit test suite on pull requests #17's pull-request-only proposal. It is kept so that main builds a run history, and it can be removed on request.
  • Tests-new: PASS (not applicable). No new functions were added; the change is CI configuration only.
  • Tests-fix: not applicable. Not a bug fix.
  • Sibling structure: PASS (not applicable). No .github/workflows/ directory existed, so there were no siblings to follow.
  • Sibling renames: not applicable. Nothing was renamed.
  • Docs: PASS. README "Running the tests" now describes the workflow, including its triggers and the submodule-less checkout. create_environments.bat, up.bat and down.bat are unaffected.
  • Issue resolution: PASS. Add CI to run the unit test suite on pull requests #17 asked for a workflow on PRs to main running python -m unittest discover -s tests, without submodules, on Python >= 3.10, with pip install pygame and a py_compile step. Each of these is present. The compile list was updated for the current tree: render_window_example.py no longer exists, and headless_run.py, usage_reporting.py and trace_client.py were added.
  • Manual validation: PASS. The run linked above ran against the PR head.

Findings:

  • .github/workflows/tests.yml:18 — actions/checkout@v4 and actions/setup-python@v5 are pinned by major-version tag, not by commit SHA. This is the common convention and is acceptable for a read-only (contents: read) test job, but SHA pinning may be preferred.
  • .github/workflows/tests.yml:23 — pygame is installed unpinned. A future pygame release could turn CI red without any change in this repository. No other dependency manifest exists in the repo to pin it against.

Merge hold: .github/workflows/* is on the do-not-auto-merge list, so this PR is left open for owner review and merge.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CI to run the unit test suite on pull requests

1 participant