Run your MediaWiki ScribuntoUnit suites headless, in CI — no wiki, no PHP, no LuaSandbox.
- Fetches the real Scribunto library for your MediaWiki release
- Resolves
require('Module:X')to your repo's files - Auto-discovers every
**/testcases.lua
-
Install a system
lua5.1—apt-get install lua5.1(Debian/Ubuntu) orbrew install lua@5.1(macOS). Don't use mise'sluaplugin; it builds from source and fails on stock CI runners. -
Add the runner to your
.mise.toml(via mise):[tools] "github:StarCitizenTools/mediawiki-scribuntounit" = { version = "0.2.0", bin_path = "bin" } [tasks.fetch] run = "scribuntounit-fetch" # downloads the Scribunto library (not bundled) [tasks.test] depends = ["fetch"] run = "scribuntounit"
-
Run
mise install— putsscribuntounitandscribuntounit-fetchon yourPATH. -
Gitignore the cache — the fetched library lands in
.scribuntounit/; add it to.gitignore.
Drop a scribuntounit.config.lua at your repo root:
return {
-- Where Module:X resolves and where **/testcases.lua are discovered.
moduleRoot = 'pages/module',
-- Which MediaWiki release's Scribunto library to fetch.
scribunto = { ref = 'REL1_43' },
-- Render primitives with no headless build: inert stubs (every method returns '').
stubs = { 'ProgressBar', 'Chart' },
-- Optional: suites to skip, with a reason.
skip = { ['Module:Legacy/testcases'] = 'needs a live-parser fixture' },
-- Optional: extend the environment.
setup = function(api)
-- api.mw -> the mw table (add mw.site overrides, …)
-- api.stub(name, value) -> register Module:<name> with a custom value
-- api.preload(name, fn) -> register a bare require() (e.g. an mw.ext.* module)
api.preload('mw.ext.myextension', function()
return { doThing = function() return '' end }
end)
end,
}Your Module:ScribuntoUnit (the assertion framework) lives under moduleRoot like any other module.
If your modules call an extension's Scribunto library, declare it under libraries to load the real upstream Lua. Its PHP leaves (render, thumb, …) default to a benign '', so interface is optional:
libraries = {
-- fetched from the extension's repo:
['mw.ext.aggrid'] = {
repo = 'StarCitizenTools/mediawiki-extensions-AGGrid',
ref = 'v0.4.0',
path = 'includes/Scribunto/mw.ext.aggrid.lua',
},
-- or a .lua already on disk:
['mw.ext.tabber'] = { path = 'path/to/mw.ext.tabber.lua' },
}scribuntounit # all suites
scribuntounit Foo # only Module: paths containing "Foo"
REPO_ROOT=/path scribuntounit # run from any cwdA GitHub Actions job — install lua5.1, then run via mise:
- uses: actions/checkout@v6
- run: sudo apt-get update && sudo apt-get install -y lua5.1
- uses: jdx/mise-action@v4
- run: mise run testMIT. See LICENSE.
- Module:ScribuntoUnit — the assertion framework this runs.
- Extension:Scribunto — upstream of the fetched library.