travis tests
parent
5105738461
commit
ca5a8bfabd
|
@ -0,0 +1,21 @@
|
|||
jobs:
|
||||
include:
|
||||
- stage: luacheck
|
||||
language: generic
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- luarocks
|
||||
before_install:
|
||||
- luarocks install --local luacheck
|
||||
script:
|
||||
- $HOME/.luarocks/bin/luacheck --no-color .
|
||||
|
||||
- stage: integration test
|
||||
language: generic
|
||||
services:
|
||||
- docker
|
||||
script:
|
||||
- ./test.sh
|
||||
|
4
init.lua
4
init.lua
|
@ -41,4 +41,8 @@ dofile(MP.."/chatcmd.lua")
|
|||
dofile(MP.."/builtin.lua")
|
||||
dofile(MP.."/protector.lua")
|
||||
|
||||
if minetest.settings:get_bool("enable_xp_redo_integration_test") then
|
||||
dofile(MP.."/integration_test.lua")
|
||||
end
|
||||
|
||||
print("[OK] XP-Redo")
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
minetest.log("warning", "[TEST] integration-test enabled!")
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.after(1, function()
|
||||
|
||||
local data = minetest.write_json({ success = true }, true);
|
||||
local file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
|
||||
if file then
|
||||
file:write(data)
|
||||
file:close()
|
||||
end
|
||||
|
||||
file = io.open(minetest.get_worldpath().."/registered_nodes.txt", "w" );
|
||||
if file then
|
||||
for name in pairs(minetest.registered_nodes) do
|
||||
file:write(name .. '\n')
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
|
||||
minetest.log("warning", "[TEST] integration tests done!")
|
||||
minetest.request_shutdown("success")
|
||||
end)
|
||||
end)
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# simple integration test
|
||||
|
||||
CFG=/tmp/minetest.conf
|
||||
MTDIR=/tmp/mt
|
||||
WORLDDIR=${MTDIR}/worlds/world
|
||||
|
||||
cat <<EOF > ${CFG}
|
||||
enable_xp_redo_integration_test = true
|
||||
EOF
|
||||
|
||||
mkdir -p ${WORLDDIR}
|
||||
chmod 777 ${MTDIR} -R
|
||||
docker run --rm -it \
|
||||
-v ${CFG}:/etc/minetest/minetest.conf:ro \
|
||||
-v ${MTDIR}:/var/lib/minetest/.minetest \
|
||||
-v $(pwd):/var/lib/minetest/.minetest/worlds/world/worldmods/epic \
|
||||
registry.gitlab.com/minetest/minetest/server:5.0.1
|
||||
|
||||
test -f ${WORLDDIR}/integration_test.json && exit 0 || exit 1
|
Loading…
Reference in New Issue