Repository navigation
ci: add a separate per-plugin test workflow and plugin test rules - #84
Conversation
Add .github/workflows/plugin-tests.yml, which runs on pull_request for plugins/** changes, detects changed plugins/<author>/<plugin> dirs that define scripts.test, and runs npm test in each via a matrix (Node 22, read-only permissions). Document plugin test conventions in CONTRIBUTING.md and CONTRIBUTING.zh-CN.md.
… and tell agents about plugin tests Review follow-up on the per-plugin test workflow: - detect: check out the PR merge commit with fetch-depth 2 and diff it against its first parent, instead of cloning the full history (108 MiB and growing) to diff base...head. - CONTRIBUTING (en/zh): use the repository's tests/ convention in the example, allow servers the test starts on 127.0.0.1 (only external hosts are off-limits), and say to delete the plugin's node_modules before npm run check, which rejects any node_modules inside a package. - AGENTS.md: add the plugin-test step, since agents read AGENTS.md rather than CONTRIBUTING. Assisted-by: Claude Opus 5.5 (OpenCode)
…nment A trial run (#88) on ubuntu-latest failed disk-insight's scanner tests, which assume macOS and Windows filesystem behaviour; on macos-latest they pass. MiniMax Code runs only on macOS and Windows, so the test job now runs on macOS (detection stays on Linux). The runner provides Node.js 22 and Git only. CONTRIBUTING (en/zh) and AGENTS.md now say so, and that a test needing another tool, such as FFmpeg or a browser, must skip itself when the tool is missing. cutline's FFmpeg-based tests fail on both runners until they do. Assisted-by: Claude Opus 5.5 (OpenCode)
|
@klarkxy, a heads-up about cutline. This workflow now runs
Until then, a PR that changes cutline shows the Plugin tests check red. It does not block merging. The test environment is described under "Plugin tests" in CONTRIBUTING.md. |
I know, will do it soon. |
|
Update: this workflow has been reverted in #89. Plugin authors keep their own tests passing, and the repository CI is back to the rule checks only. @klarkxy, this means cutline PRs will not show a red Plugin tests check after all. One finding from the trial is still worth a look for your own runs: on macOS, |
Adds a workflow that runs a plugin's own tests only when a pull request changes that plugin and the plugin declares a
testscript. It also documents how contributors write those tests.What changes
.github/workflows/plugin-tests.yml(new)pull_requestonly, limited to changes underplugins/**. Runs withpermissions: contents: read, and checkout usespersist-credentials: false. There are no secrets, so it is safe on fork PRs.fetch-depth: 2and diffs it against its first parent. From that diff it lists the changedplugins/<author>/<plugin-id>directories and keeps those whosepackage.jsonhas a non-emptyscripts.test.fail-fast: false): sets up Node.js 22, installs dependencies (npm ciwhen the plugin has a lockfile), then runsnpm testin the plugin directory.CONTRIBUTING.md/CONTRIBUTING.zh-CN.md: a "Plugin tests" section.tests/), and run through itsnpm test.127.0.0.1is fine.node_modulesbeforenpm run check, which rejects anynode_modulesinside a package.test/stays reserved for the repository's rule checks.AGENTS.md: the same rules as an optional step beforenpm run check, since agents read AGENTS.md rather than CONTRIBUTING.The rules CI (
npm run check), the roottest/, the scripts, and the rootpackage.jsonare unchanged.Review changes (on top of the first commit)
fetch-depth: 2instead of cloning the full history (108 MiB) forbase...head.tests/convention, allow loopback servers, add thenode_modulesnote, and gain the AGENTS.md step.macos-latest, and state the test environment (see the trial below).Verification
tests/but noscripts.test;mainhad also moved: only the PR's own files are listed.testscript, plus cq-viewer, which has none.detectselected exactly the four:The workflow on this branch differs from the one that ran on #88 only by a comment line. Windows, MiniMax Code's other platform, was not run; the squash commit's note that disk-insight's tests assume Windows behaviour too is unverified.
Known red: cutline
cutline's failures come from the test environment, not from this workflow:
ffmpegto make fixture clips (tests/helpers.mjs), and the runner has none. The other failures follow from those missing clips.import-url-security.test.mjsalso listens on127.0.0.2. macOS configures only127.0.0.1on loopback, so the listen fails withEADDRNOTAVAIL.The browser tests in
i18n-browser.test.mjsalready skip when no Chromium is found; the same pattern fixes the FFmpeg tests. Until cutline does that, a PR that changes cutline shows this check red.mainhas no required checks, so this does not block merging.