feat: Plugin Testsuite as Developer CI Workflow#2400
feat: Plugin Testsuite as Developer CI Workflow#2400dirkwa wants to merge 12 commits intoSignalK:masterfrom
Conversation
0996aba to
4cff9e4
Compare
bdec939 to
8467b29
Compare
ac22586 to
d30a179
Compare
|
Here a sample of plugin supporting the full integration test (full featured): |
Freeboard-SK - PASShttps://github.com/dirkwa/freeboard-sk/actions/runs/22748268277 With the following waring:
KIP - FAILEDhttps://github.com/dirkwa/Kip/actions/runs/22748279814 Warning:
Error:
|
|
The logic here is too aggressive and partly faulty, don’t start flagging plugins based on this. But I will guard my time and won’t address this PR until others that are higher prio are done. |
|
No problem, there are plenty of PRs in the queue. This tool surfaced in my Plugins weak points I was not aware of. Maintained wisely I am more than certain it will be a great addon to help Plugin developers and stabilize the SignalK ecosystem. |
Test CI detects Plugin crashes Serverhttps://github.com/oyve/signalk-barometer-trend TestCI Run: https://github.com/dirkwa/signalk-barometer-trend/actions/runs/23087891542 |
|
UPDATE - Done in 6153182 TODO: Verify semver - #2455 Sample: https://www.npmjs.com/package/stingray-signalk/v/0.1.1?activeTab=code |
Reusable GitHub Actions workflow that plugin developers can adopt with a single file in their repo. Tests plugins across Linux x64, Linux arm64 (Raspberry Pi), macOS, Windows (Node 22 + 24) and armv7/Cerbo GX (Node 20 via QEMU). Validation checks run even for plugins without a test suite: - package.json structure (keyword, main/exports, engines.node) - Entry point exports a constructor function - plugin.schema() returns valid JSON Schema - Lifecycle: start/stop/restart with empty config, delta validation - API usage scan (deprecated APIs, internal properties, route and file storage anti-patterns, security anti-patterns, node: built-in module version mismatches) - npm pack includes all required files - App Store compatibility (no native addons with --ignore-scripts) - No stray files left after build/test armv7 emulates Venus OS 3.70 on Cerbo GX using QEMU with node:20-bookworm-slim plus python3, make, and g++. The armv7 Node version is fixed to match the Cerbo and is not user-configurable. armv7 failures are advisory and non-blocking. Optional integration test installs a Signal K server, packs and installs the plugin, auto-configures it, starts the server with sample NMEA data, and verifies the plugin loads.
- plugin-caller-example.yml: copy-paste one-liner that calls the shared reusable workflow - standalone-ci.yml: self-contained version with all the same checks for repos that prefer no external workflow dependency
Documents the reusable workflow, platform matrix, validation checks, armv7/Cerbo GX emulation, integration tests, configuration options, and self-hosted runner setup.
Start the server with --sample-nmea0183-data --sample-n2k-data --override-timestamps so plugins have a rich data environment (navigation, wind, depth, temperature, battery, etc.) instead of just NMEA 0183 position/heading data.
…ational notice registerHistoryProvider() is the v1 history API (playback/snapshots), coexisting with registerHistoryApiProvider() (v2 time-series). The CI incorrectly flagged v1 as deprecated. Change to a ::notice:: that points plugin authors to v2 without implying v1 is wrong.
npm normalizes invalid versions (e.g. '0.1.01' → '0.1.1') in its registry metadata, but the installed package.json retains the original invalid string. This breaks semver.gt() in the appstore, crashing the entire plugin listing. Catch this before publishing by validating the version field against the semver spec regex.
957076b to
6153182
Compare
- Add missing ServerAPI methods to lifecycle mock (readPluginOptions, savePluginOptions, getDataDirPath, selfContext, and other commonly used methods) - Fix schema check to handle both object and function forms, as both are valid per the Plugin interface - Add registerWithRouter() call before start() to match real server plugin loading sequence - Improve error messages to distinguish CI mock gaps from real plugin bugs
Remove standalone-ci.yml and its documentation references — the reusable workflow is the single source of truth, avoiding dual maintenance. Upgrade actions/checkout v4→v6, actions/setup-node v4→v6, and actions/upload-artifact v4→v7 to eliminate Node.js 20 deprecation warnings.
…3→v4 Eliminates remaining Node.js 20 deprecation warning on the armv7 job.
…check Native addons marked as optional in the lockfile (e.g. cpu-features from ssh2) now produce a warning instead of failing the build. The parent package declares them optional and is expected to fall back gracefully. Required native addons remain a hard error.
Each ::warning:: and ::error:: line becomes a separate annotation in the GitHub UI. Merge multi-line messages into single annotations for cleaner output.
Summary
Adds a reusable GitHub Actions workflow that plugin developers can adopt with a single file. Plugins break silently when signalk-server updates — this gives every plugin cross-platform CI, even those without a test suite.
Quick start for plugin developers
Create
.github/workflows/signalk-ci.yml:That's it — one file, full cross-platform CI.
Platforms
Adds a reusable GitHub Actions workflow that plugin developers can adopt with a single file. Plugins break silently when signalk-server updates — this gives every plugin cross-platform CI, even those without a test suite.
Quick start for plugin developers
Create
.github/workflows/signalk-ci.yml:That's it — one file, full cross-platform CI.
Platforms
Why armv7 is pinned to Node 20
The Victron Cerbo GX runs Venus OS 3.70 which ships Node 20.18.2. The CI emulates this exact environment using QEMU with a
node:20-bookworm-slimDocker image pluspython3,make, andg++— matching what's available on the Cerbo via opkg. The Node version is fixed and not user-configurable to keep the test environment as close to real hardware as possible. armv7 jobs are advisory and non-blocking — failures are reported but don't fail the overall CI, since most plugin developers target desktop platforms first.Validation checks (desktop jobs)
Every desktop job runs these checks, even for plugins without a test suite:
signalk-node-server-pluginkeyword,mainorexportsfield,engines.nodedeclarationstart()→stop()→start()(restart) with empty config; validates delta messages andregisterDeltaInputHandlerforwardingsetProviderStatus), internal server properties (app.server,app.deltaCache), route anti-patterns (directapp.get()instead ofregisterWithRouter()), file storage anti-patterns (__dirnameinstead ofapp.getDataDirPath()), security anti-patterns (app.securityStrategy), and Node built-in version mismatches (node:sqlitewithoutengines.node >= 22.5.0)main/exportsare included in the published package--ignore-scripts(as the App Store does) and checks for native addon dependenciesIntegration tests (opt-in)
Enable with
enable-signalk-integration: trueto install a Signal K server, pack and install the plugin, auto-configure it, start the server with sample NMEA data, and verify the plugin loads. Runsnpm run test:integrationif defined.Configuration
test-commandnpm testbuild-commandnpm run build --if-presentnode-versions["22", "24"]enable-armv7trueenable-signalk-integrationfalsesignalk-server-versionlatestPlugins without a
testscript get all validation checks — tests are skipped with a notice.Tested with
Files
.github/workflows/plugin-ci.yml.github/examples/plugin-caller-example.yml.github/examples/standalone-ci.ymldocs/develop/plugins/ci.md