Skip to content

ci: run the spec suite on push and pull request - #6

Open
voyager wants to merge 2 commits into
davepwsmith:mainfrom
voyager:ci/run-specs-on-pull-request
Open

voyager wants to merge 2 commits into
davepwsmith:mainfrom
voyager:ci/run-specs-on-pull-request

Conversation

@voyager

@voyager voyager commented Aug 16, 2026

Copy link
Copy Markdown

release.yml only fires on a v* tag, so nothing checks a change before it
lands — the three PRs currently open (#3, #4, #5) have no automated signal on
any of them. This adds a check that runs on push and pull request.

What it does

  • installs LuaJIT
  • byte-compiles every file under karako.koplugin/
  • runs spec/all.lua

Nothing else is needed: spec/all.lua sets package.path the way KOReader's
pluginloader does — which is what makes the modules testable without KOReader in
the first place — and it already ends os.exit(Runner.report() and 0 or 1), so
it fails loudly without a wrapper. The whole job is a few seconds.

The byte-compile step is there for a syntax error in a file the specs happen not
to require. In a plugin that does not surface as a failing test; it surfaces as
KOReader quietly declining to load the plugin at runtime.

Two details worth the review time

xargs, not find -exec. find reports its own exit status rather than the
command's, so find … -exec luajit -bl {} \; exits 0 even when a file does not
compile — a gate that always passes. I had exactly that in the first draft and
caught it by feeding in a deliberately broken file. find -print0 | xargs -0 -n1
propagates the failure.

One file per invocation. luajit -b takes a single input, so batching with
-exec … + makes it treat the second path as an output.

Verified both ways: clean tree exits 0, a file with this is not lua appended
exits non-zero, and an added failing assertion makes the spec step exit 1.

Cost

None. Actions minutes are free and unlimited for public repositories.

Note

Happy for this to be shaped differently — pinned action SHAs, a matrix over Lua
versions, restricting push to main — or dropped entirely if you would rather
not have CI here. I opened it because I have three PRs in flight against this
repo and it seemed wrong to ask you to review them with nothing checking them.

voyager and others added 2 commits August 16, 2026 16:22
release.yml only fires on a v* tag, so nothing checks a change before it lands.
Three open PRs have gone up with no automated signal on any of them.

The suite needs nothing but a LuaJIT binary -- spec/all.lua sets package.path
the way KOReader's pluginloader does, precisely so the modules can be exercised
without KOReader -- and it finishes in under a second. It already exits non-zero
on failure, so it needs no wrapper.

Byte-compiling every plugin file alongside catches a syntax error in one the
specs happen not to require, which on a plugin means KOReader silently refusing
to load it at runtime.

xargs rather than find -exec for that step: find reports its own exit status
and not the command's, so an -exec form passes even when a file does not
compile. Verified both ways -- clean tree exits 0, a deliberately broken file
exits non-zero.

Actions minutes are free for public repositories, so this costs the project
nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
v4 targets Node 20, which GitHub deprecated; the runner forces it onto Node 24
and annotates every run with a warning.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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