|
| 1 | +# CLAUDE.md — joypad-tester |
| 2 | + |
| 3 | +This repo holds one test app per console, each in its own subdirectory. |
| 4 | +The patterns below describe how each console subdir is structured so |
| 5 | +that new consoles can be added without churning the top-level scaffolding |
| 6 | +or the CI/release wiring. |
| 7 | + |
| 8 | +## Repository shape |
| 9 | + |
| 10 | +``` |
| 11 | +. |
| 12 | +├── CLAUDE.md # this file |
| 13 | +├── LICENSE.md # MIT, covers repo scaffolding + any future common/ |
| 14 | +├── README.md # top-level overview |
| 15 | +├── .github/ |
| 16 | +│ ├── FUNDING.yml # Sponsor button → RobertDaleSmith |
| 17 | +│ └── workflows/ |
| 18 | +│ ├── verify-build.yml # matrix CI for every push/PR |
| 19 | +│ └── release.yml # tag-driven per-console releases |
| 20 | +├── <console>/ # one subdir per supported console |
| 21 | +│ ├── VERSION # bare semver string, e.g. "0.1.0" |
| 22 | +│ ├── CHANGELOG.md # console-scoped, header style: "## v0.1.0 — YYYY-MM-DD" |
| 23 | +│ ├── LICENSE.md # whatever the upstream code's licence is |
| 24 | +│ ├── README.md # console-scoped overview |
| 25 | +│ ├── Makefile # console-specific build |
| 26 | +│ ├── source/ (or ppc/, etc.) |
| 27 | +│ ├── build*/ # build outputs; intermediate files gitignored, |
| 28 | +│ │ # final artifacts (.dol/.gba/_payload.c) committed |
| 29 | +│ │ # if downstream consumers need them prebuilt |
| 30 | +│ └── ... |
| 31 | +└── common/ # (future) cross-console shared helpers |
| 32 | +``` |
| 33 | + |
| 34 | +Existing console subdirs at time of writing: |
| 35 | + |
| 36 | +- `gamecube/` — GameCube + Wii test app (libogc2-based, builds .dol; |
| 37 | + also surfaces N64 controllers via the passive adapter on GC ports). |
| 38 | + Origin: zlib (corenting GC-Controller-Test); `gamecube/LICENSE.md`. |
| 39 | +- `gba/` — GBA multiboot payload, two variants from one source tree |
| 40 | + (eyes for joypad-os consumers, tester for the GameCube host or |
| 41 | + flashcart use). Origin: MIT (Doridian Joybus-PIO); `gba/LICENSE.md`. |
| 42 | + |
| 43 | +## Console subdir conventions |
| 44 | + |
| 45 | +Each console subdir is a self-contained product. Adding a new one |
| 46 | +should not require touching anything outside its own directory, with |
| 47 | +the exception of the two CI workflows and CLAUDE.md's "Existing console |
| 48 | +subdirs" list. |
| 49 | + |
| 50 | +### Files every console subdir must have |
| 51 | + |
| 52 | +| File | Purpose | |
| 53 | +|---------------|---------------------------------------------------------------| |
| 54 | +| `VERSION` | Bare semver string. Must match the release tag (see below). | |
| 55 | +| `CHANGELOG.md`| Per-console changelog. First section header `## v<semver> — <date>`. | |
| 56 | +| `LICENSE.md` | Whatever the upstream code's licence is (zlib, MIT, …). | |
| 57 | +| `README.md` | Audience-facing overview: what the app is, how to build, how to embed. | |
| 58 | +| `Makefile` | Build entrypoint. Use a Docker-based toolchain if it eases CI. | |
| 59 | + |
| 60 | +### Build outputs |
| 61 | + |
| 62 | +Intermediates (`*.o`, `*.d`, `*.elf`, `*.map`) should be `.gitignore`d. |
| 63 | +Final artifacts (`*.dol`, `*.gba`, `*_payload.c`) get committed **only |
| 64 | +when downstream consumers need them prebuilt** (e.g., joypad-os |
| 65 | +submodules `gba/` and consumes `build/joypad/joypad_payload.c` without |
| 66 | +running devkitARM). For consoles whose artifacts are end-user |
| 67 | +downloads only, leave them out of git and let the release workflow |
| 68 | +build them. |
| 69 | + |
| 70 | +## CI: build verification (`.github/workflows/verify-build.yml`) |
| 71 | + |
| 72 | +Runs on every push to `main` and every PR. Strategy is a matrix: |
| 73 | + |
| 74 | +```yaml |
| 75 | +matrix: |
| 76 | + include: |
| 77 | + - console: <name> |
| 78 | + image: <docker image with the toolchain> |
| 79 | + artifacts: | |
| 80 | + <path/to/output1> |
| 81 | + <path/to/output2> |
| 82 | +``` |
| 83 | +
|
| 84 | +Per-console steps are gated with `if: matrix.console == '<name>'` so a |
| 85 | +matrix entry only runs the build commands it needs. Adding a console |
| 86 | +means adding a matrix entry + the corresponding build step(s). |
| 87 | + |
| 88 | +## CI: releases (`.github/workflows/release.yml`) |
| 89 | + |
| 90 | +Tag-driven. Tag format: `<console>-v<semver>` (e.g. `gamecube-v0.1.0`, |
| 91 | +`gba-v0.2.3`). Pre-release suffixes allowed (`-alpha.1`, `-rc.2`, …). |
| 92 | + |
| 93 | +The workflow: |
| 94 | + |
| 95 | +1. Parses the tag to extract `<console>` and `<semver>`. |
| 96 | +2. Verifies `<console>/VERSION` matches the tag's version. (Mismatch |
| 97 | + fails the build — there's no auto-bump.) |
| 98 | +3. Builds the requested console (gated by `if:` on each build step, |
| 99 | + same pattern as verify-build). |
| 100 | +4. Stages release artifacts into `<console>/_release/` (also gated). |
| 101 | +5. Extracts the relevant section of `<console>/CHANGELOG.md` as the |
| 102 | + release body (`## v<semver> — <date>` to the next `## ` header). |
| 103 | +6. Creates a GitHub Release with the artifacts attached. |
| 104 | + |
| 105 | +Adding a console = adding a build step + a stage-artifacts step (both |
| 106 | +gated on `if: needs.parse.outputs.console == '<name>'`), and a case for |
| 107 | +the pretty name in the `parse` job. |
| 108 | + |
| 109 | +## Release flow for a console |
| 110 | + |
| 111 | +To cut, e.g., `gba-v0.2.0`: |
| 112 | + |
| 113 | +1. Bump `<console>/VERSION` to `0.2.0`. |
| 114 | +2. Prepend a new section to `<console>/CHANGELOG.md`: |
| 115 | + `## v0.2.0 — YYYY-MM-DD` followed by bullet-point release notes. |
| 116 | +3. Commit + push to `main`. |
| 117 | +4. Tag `<console>-v0.2.0` and push the tag. |
| 118 | +5. CI parses the tag, verifies VERSION, builds, and publishes the |
| 119 | + GitHub Release with artifacts + the changelog section as the body. |
| 120 | + |
| 121 | +If `VERSION` doesn't match the tag, the release fails (intentional — |
| 122 | +forces the changelog and version-bump commits to land before the tag). |
| 123 | + |
| 124 | +## When extending or refactoring |
| 125 | + |
| 126 | +- Top-level scaffolding (workflows, CLAUDE.md, repo-wide README, top- |
| 127 | + level LICENSE.md) is shared and should stay generic. If a new |
| 128 | + console needs something fundamentally different that doesn't fit |
| 129 | + the conventions above, prefer extending the conventions (and |
| 130 | + documenting here) over per-console drift. |
| 131 | +- A `common/` dir for cross-console helpers is reserved and should |
| 132 | + inherit the top-level MIT licence. |
| 133 | +- Submodule consumers (joypad-os pulls in `gba/`) rely on the |
| 134 | + committed prebuilt artifacts in `build/`. Don't break that path |
| 135 | + without coordinating the consumer side. |
0 commit comments