Skip to content

Migrate ./build to a Makefile and add smoke tests#70

Merged
jamieleecho merged 4 commits into
mainfrom
migrate-build-to-makefile
May 2, 2026
Merged

Migrate ./build to a Makefile and add smoke tests#70
jamieleecho merged 4 commits into
mainfrom
migrate-build-to-makefile

Conversation

@jamieleecho
Copy link
Copy Markdown
Owner

@jamieleecho jamieleecho commented May 2, 2026

Summary

  • Replaces ./build with a Makefile exposing help (default), build, test, shell, lint, size, push, and clean targets.
  • Adds tests/ organized by tool (java_grinder/, basto6809/, mcbasic/, cmoc-os9/) with hello-world sources for each.
  • Adds .dockerignore so docker compose build only sends what the Dockerfile actually needs.
  • Wires make test, make size, and make lint into CI.
  • Fixes shellcheck-flagged bugs in coco-dev and utils/basto6809todsk.

Release notes

New developer commands

  • make build — builds the docker image (replaces ./build).
  • make test — runs four smoke tests inside the just-built container:
    1. javac + java_grinder + naken_asm → CoCo Java binary
    2. basto6809todsk → CoCo .DSK from BASIC source
    3. mcbasic → MC-10 .c10 from BASIC source
    4. cmoc --os9 → OS-9 module from C source
  • make shell — drops you into a one-off bash shell in the image.
  • make lint — runs shellcheck against coco-dev and utils/basto6809todsk via the koalaman/shellcheck-alpine image (no host install required).
  • make size — prints the size of the built image (e.g. jamieleecho/coco-dev:0.79: 1271.08 MB).
  • make push — pushes the image to Docker Hub.
  • make clean — removes the local image.
  • Override the tag with make test TAG=jamieleecho/coco-dev:0.79.

Bug fixes (shellcheck)

  • coco-dev: arguments with spaces are now preserved correctly. Previously coco-dev cmd "foo bar" would split foo bar into two separate arguments inside the container because the script joined args via $* and re-split on IFS. Switched to "$@" and quoted array expansions.
  • utils/basto6809todsk: quoted all variable expansions, replaced legacy backticks with $(...), added set -eu, fixed shebang to /usr/bin/env bash.

CI

  • New lint job runs make lint on every PR/push (fast, single ubuntu runner).
  • build_and_push_image: now runs make test and make size after each per-arch build, before pushing.
  • docker/build-push-action@v6 doesn't allow load: true and push: true together, so the workflow now builds with load: true (image available locally for smoke tests), then a separate docker push step runs on tag pushes.

Image

  • .dockerignore excludes .git, .github, tests, Makefile, README.md, etc. from the build context. Faster docker compose build invocations and avoids accidentally shipping dev files.

Test plan

  • make help prints target list with computed tag from package.json.
  • make build succeeds with the new .dockerignore.
  • make test passes locally (all 4 smoke tests).
  • make lint passes (no shellcheck warnings).
  • make size prints 1271.08 MB for the locally-built image.
  • CI smoke test, lint, and size steps pass after merge.

🤖 Generated with Claude Code

jamieleecho and others added 4 commits May 2, 2026 16:37
- Replace ./build with a Makefile exposing help/build/test/push/clean
  targets. Default target is help.
- Add tests/ with four hello-world sources (Java Grinder, BasTo6809,
  mcbasic, CMOC OS-9). `make test` mounts them read-only into a
  freshly-built container, runs each toolchain, and verifies outputs
  exist.
- Update README to use `make build` instead of `./build`.
- Update build-docker.yml workflow: checkout, build with load:true,
  run smoke tests, then push image only on tag pushes (build-push-action
  v6 doesn't allow load+push together).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- .dockerignore: excludes everything not needed by the build
  (Dockerfile only consumes utils/basto6809todsk from the context).
- tests/ reorganized into per-tool subfolders:
    tests/java_grinder/, tests/basto6809/, tests/mcbasic/, tests/cmoc-os9/
- Makefile additions:
    make shell  one-off bash shell in the image
    make lint   shellcheck via koalaman/shellcheck-alpine
    make size   prints image size in MB
- Fix shellcheck issues in coco-dev and utils/basto6809todsk:
    - Use "$@" array instead of "$*" so args with spaces are preserved
    - Quote variable expansions
    - Replace legacy backticks with $(...)
    - Add `set -eu` to basto6809todsk
    - /bin/env -> /usr/bin/env shebang (POSIX)
- CI: add a fast `lint` job and an Image size step after smoke tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pushing to a branch with an open PR was firing both `push` and
`pull_request: synchronize` — double the CI minutes for the same
commit. Drop the pull_request trigger; push-trigger covers every
same-repo branch. Concurrency group cancels superseded runs when
multiple commits land in quick succession.

Tradeoff: PRs from forks no longer auto-trigger CI (they wouldn't
have had access to DOCKERHUB_TOKEN anyway).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both matrix jobs (ubuntu-24.04 and ubuntu-24.04-arm) were writing to
the default GHA cache slot in parallel; the second to start would
race and fail with `error writing layer blob: failed to reserve
cache`. Giving each arch its own scope eliminates the collision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jamieleecho jamieleecho merged commit 02e05c2 into main May 2, 2026
14 of 17 checks passed
@jamieleecho jamieleecho deleted the migrate-build-to-makefile branch May 2, 2026 21:32
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.

1 participant