Build and smoke-test the Docker image in PR CI - #68
Merged
Conversation
The publish workflows only run on `v*` tags, so a broken Dockerfile or build script stayed invisible until release. That was a live gap: #66 replaced the yaml copy step of `npm run build` and nothing in PR CI would have caught a container-level break. Adds a `docker` job that builds the image and smoke-tests the running container. It never pushes — the tag-triggered workflows still own publishing. The swagger assertions deliberately avoid grepping for "openapi": the base definition is inlined in src/index.ts, so that string is present even when every yaml file is missing from the image. Verified against a purpose-built broken image (same build with dist/**/*.yaml deleted) — `openapi` still matched, while 'Get the service status' (from root.yaml) and 'ssnFour' (from random-person.yaml) both correctly failed. Uses plain `docker build` rather than docker/build-push-action, matching publish.yml's style and avoiding another action to keep version-bumped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the gap documented in #67: the publish workflows only run on
v*tags, so a brokenDockerfileor build script stayed invisible until release.That was a live gap, not a hypothetical — #66 replaced the yaml copy step of
npm run build, and nothing in PR CI would have caught a container-level break.What it does
A
dockerjob that builds the image and smoke-tests the running container. It never pushes — the tag-triggered workflows still own publishing.The assertions have teeth
The obvious check — grepping
/api-docsoutput foropenapi— is useless here, because the base definition is inlined insrc/index.ts, so that string is present even with every yaml file missing from the image.Verified against a purpose-built broken image (identical build with
dist/**/*.yamldeleted):grep openapigrep 'Get the service status'(fromroot.yaml)grep ssnFour(fromrandom-person.yaml)The job also fails loudly with container logs if the server never becomes ready, so a crash-looping container reports rather than hanging to timeout.
Implementation note
Plain
docker buildrather thandocker/build-push-action, matchingpublish.yml's existing style and avoiding another action to keep version-bumped.This PR's own CI run is the proof it works.
🤖 Generated with Claude Code