Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# the declared floor in README.md, and a current release
python-version: ["3.8", "3.13"]
steps:
- uses: actions/checkout@v5

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Compile both modules
run: python -m py_compile src/collide.py src/ideaCollisionGenerator.py

- name: Run the test suite
run: python -m unittest discover -s tests -v

# the suite patches every prompt, so the real stdin path documented in
# README.md is exercised here instead
- name: Run the program end to end
run: |
printf 'k%s\n' 1 2 3 4 5 6 7 8 9 10 > fixture.txt
printf 'idea %s\n' 1 2 3 4 5 >> fixture.txt
python src/collide.py < fixture.txt
written=$(cat ideas/ideas-*.txt | wc -l)
test "$written" -eq 5
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ python3 -m unittest discover -s tests

Every prompt is patched, so no test waits on real input.

[`.github/workflows/tests.yml`](.github/workflows/tests.yml) runs the same
commands on every push to `main` and on every pull request, against Python 3.8
and 3.13: `py_compile` over both modules, the test suite, and one full run of
the program with a 15-line fixture on stdin.

## License

See [LICENSE](LICENSE).