Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
# The Viron submodule is deliberately not checked out: the test suite stubs it in
# sys.modules, and only main.py needs it at runtime.
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

# render_window.py imports pygame, and tests/test_headless_run.py drives the real
# pygame with SDL's dummy drivers, so it has to be installed even though most tests mock it.
- name: Install dependencies
run: python -m pip install pygame

- name: Check syntax
run: python -m py_compile main.py graphik.py __init__.py render_window.py headless_run.py usage_reporting.py trace_client.py

- name: Run unit tests
run: python -m unittest discover -s tests
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ python -m unittest discover -s tests

Run the command from the repository root, so that `main.py` and `render_window.py` are importable.

The same command, preceded by a `py_compile` syntax check of the top-level modules, is run by the `Tests` GitHub Actions workflow (`.github/workflows/tests.yml`) on every pull request targeting `main` and on every push to `main`. The workflow checks the repository out without the `Viron` submodule, since the suite does not need it.

### Running without Docker or a display

`headless_run.py` drives `main()` end to end when neither a Viron server nor a display is available. The real Pygame, `RenderWindow` and `Graphik` are used, rendering to SDL's `dummy` video and audio drivers (unless `SDL_VIDEODRIVER` or `SDL_AUDIODRIVER` is already set); only Viron is replaced, by in-memory services with one location per grid cell. Like the test suite, it needs neither the `Viron/` submodule nor Python 3.10+.
Expand Down
Loading