diff --git a/.github/maintainer/MAINTAINER.md b/.github/maintainer/MAINTAINER.md index 4739ec1e..1b0faede 100644 --- a/.github/maintainer/MAINTAINER.md +++ b/.github/maintainer/MAINTAINER.md @@ -65,7 +65,8 @@ it, and every one of them gets a home. Pick the smallest home that fits (CONTRIB examples/README, the brand line and the counts are generated from those files: a list PR never needs README rows, and rows an older PR added are dropped on merge (`tools/gen_tables.py --adopt` turns them into its `tv.json`). - After merging lists, the maintainer runs `python3 tools/gen_tables.py` on main and commits what it rewrites - (with `--font Fredoka.ttf` it also redraws the card when a count changed); CI on main fails until then. + (with `--font Fredoka.ttf` it also redraws the card when a count changed); CI's "README tables" job on main + stays red until then, and only that job. - `pm hide`/`pm block` needs the matching unhide/unblock undo in the header. ## Scope and taste diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 525192e3..3938acdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,20 @@ jobs: env: CLEANYOURTV_STRICT: ${{ github.event_name == 'push' && '1' || '' }} run: python3 -m unittest discover -s tests -v - # On a pull request the tables are expected to lag: a list PR adds only its folder and tv.json. + + tables: + # Main only: a list PR adds just its folder and tv.json, so on a pull request the tables lag on purpose. + # A job of its own, so "the tables want regenerating" never reads as "the lists are broken": the merge + # bot waits for main to be green between merges and regenerates the tables after the wave. + name: README tables + if: github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" - name: README TV tables match examples/*/tv.json - if: github.event_name == 'push' run: | python3 tools/gen_tables.py --check || { echo "::error::README.md and examples/README.md are generated from examples/*/tv.json. A maintainer runs python3 tools/gen_tables.py on main and commits the result; contributors never need to." diff --git a/AGENTS.md b/AGENTS.md index 8d03d717..7fdf1251 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -115,7 +115,7 @@ use it and ends with the check to run. | Check | Command or rule | |---|---| -| Tests, as CI runs them | `python3 -m unittest discover -s tests -v` after `python3 -m venv tools/venv` and `tools/venv/bin/pip install -r tools/requirements.txt`. On `main`, CI sets `CLEANYOURTV_STRICT=1`, which also checks that the TV tables and counts are what `tools/gen_tables.py` writes. | +| Tests, as CI runs them | `python3 -m unittest discover -s tests -v` after `python3 -m venv tools/venv` and `tools/venv/bin/pip install -r tools/requirements.txt`. On `main`, CI sets `CLEANYOURTV_STRICT=1`, and its "README tables" job checks that the TV tables and counts are what `tools/gen_tables.py` writes. | | Launcher, if you touched `launcher/` | JDK 17, Android SDK platform 34, build-tools 34.0.0. In `launcher/`: `./gradlew --no-daemon testReleaseUnitTest lintRelease assembleRelease`. Lint must stay at zero errors. | | APK size gate | `launcher/app/build/outputs/apk/release/app-release.apk` must be under 524,288 B (512 KB). Linux: `stat -c %s`, macOS: `stat -f %z`. | | README rows | A new list adds only its folder, with a `tv.json`: the TV tables, the brand line and the counts are generated after merging, so leave them alone. A theme has its row in `themes/README.md`; an add-on in `addons/README.md`. | diff --git a/tests/test_examples.py b/tests/test_examples.py index fc6d3f1c..7e9dcedd 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,11 +1,11 @@ """Checks every TV list in examples/ and the two tables that index them. -The tables are generated from each folder's tv.json by tools/gen_tables.py. On a pull request only the -tv.json files are checked; on main (CLEANYOURTV_STRICT) the committed tables must be what the script writes. +The tables are generated from each folder's tv.json by tools/gen_tables.py. Here only the tv.json files +are checked; that the committed tables and counts are what the script writes is CI's "README tables" job, +on main only, kept apart so a list merge waiting for its regenerated tables doesn't turn these tests red. Run from the repository root: python3 -m unittest discover -s tests -v """ -import os import re import sys from pathlib import Path @@ -68,12 +68,6 @@ class ExampleListsTest(unittest.TestCase): except gen_tables.Problem as e: self.fail(str(e)) - @unittest.skipUnless(os.environ.get("CLEANYOURTV_STRICT"), "tables are generated on merge; strict on main only") - def test_tables_are_generated(self): - self.assertEqual(gen_tables.stale(ROOT), [], - "README tables are out of date: a maintainer runs python3 tools/gen_tables.py " - "after merging and commits the result") - def test_readme_table_has_one_row_per_list(self): readme_rows = table_rows(ROOT / "README.md", "| TV | OS |") example_rows = table_rows(EXAMPLES / "README.md", "| Folder |") @@ -83,12 +77,6 @@ class ExampleListsTest(unittest.TestCase): example_tvs = sorted(r.split("|")[2].strip() for r in example_rows) self.assertEqual(readme_tvs, example_tvs, "the TV column differs between the two tables") - @unittest.skipUnless(os.environ.get("CLEANYOURTV_STRICT"), "counts are fixed up on merge; strict on main only") - def test_readme_counts(self): - text = (ROOT / "README.md").read_text(encoding="utf-8") - n = len(folders()) - self.assertIn(f"{n} TV models", text, "stat strip alt text is stale (regenerate docs/stats.png too)") - if __name__ == "__main__": unittest.main()