mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-22 06:40:22 +01:00
add workflows and integration test
This commit is contained in:
parent
217f468e92
commit
a8cc5d9b08
15
.github/workflows/integration-test.yml
vendored
Normal file
15
.github/workflows/integration-test.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
name: integration-test
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: textbook/git-checkout-submodule-action@master
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: ./integration-test.sh
|
17
.github/workflows_disabled/luacheck.yml
vendored
Normal file
17
.github/workflows_disabled/luacheck.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: luacheck
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: apt
|
||||||
|
run: sudo apt-get install -y luarocks
|
||||||
|
- name: luacheck install
|
||||||
|
run: luarocks install --local luacheck
|
||||||
|
- name: luacheck run
|
||||||
|
run: $HOME/.luarocks/bin/luacheck ./
|
@ -4,13 +4,18 @@
|
|||||||
CFG=/tmp/minetest.conf
|
CFG=/tmp/minetest.conf
|
||||||
MTDIR=/tmp/mt
|
MTDIR=/tmp/mt
|
||||||
WORLDDIR=${MTDIR}/worlds/world
|
WORLDDIR=${MTDIR}/worlds/world
|
||||||
|
WORLDMODDIR=${WORLDDIR}/worldmods
|
||||||
|
|
||||||
# TODO: pipeworks / basic_materials
|
# settings
|
||||||
cat <<EOF > ${CFG}
|
cat <<EOF > ${CFG}
|
||||||
enable_technic_integration_test = true
|
enable_technic_integration_test = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p ${WORLDDIR}
|
rm -rf ${WORLDDIR}
|
||||||
|
mkdir -p ${WORLDMODDIR}
|
||||||
|
git clone https://gitlab.com/VanessaE/basic_materials.git ${WORLDMODDIR}/basic_materials
|
||||||
|
git clone https://gitlab.com/VanessaE/pipeworks.git ${WORLDMODDIR}/pipeworks
|
||||||
|
|
||||||
chmod 777 ${MTDIR} -R
|
chmod 777 ${MTDIR} -R
|
||||||
docker run --rm -i \
|
docker run --rm -i \
|
||||||
-v ${CFG}:/etc/minetest/minetest.conf:ro \
|
-v ${CFG}:/etc/minetest/minetest.conf:ro \
|
||||||
|
@ -51,3 +51,6 @@ if minetest.settings:get_bool("log_mods") then
|
|||||||
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
|
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.settings:get_bool("enable_technic_integration_test") then
|
||||||
|
dofile(modpath.."/integration_test.lua")
|
||||||
|
end
|
||||||
|
56
technic/integration_test.lua
Normal file
56
technic/integration_test.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
minetest.log("warning", "[technic] integration-test enabled!")
|
||||||
|
|
||||||
|
-- those mods have to be present
|
||||||
|
local assert_mods = {
|
||||||
|
"technic",
|
||||||
|
"pipeworks"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- those nodes have to be present
|
||||||
|
local assert_nodes = {
|
||||||
|
"technic:admin_anchor"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- defered integration test function
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
minetest.log("warning", "[technic] all mods loaded, starting delayed test-function")
|
||||||
|
|
||||||
|
minetest.after(1, function()
|
||||||
|
minetest.log("warning", "[technic] starting integration test")
|
||||||
|
|
||||||
|
-- export stats
|
||||||
|
local 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
|
||||||
|
|
||||||
|
-- check mods
|
||||||
|
for _, modname in ipairs(assert_mods) do
|
||||||
|
if not minetest.get_modpath(modname) then
|
||||||
|
error("Mod not present: " .. modname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check nodes
|
||||||
|
for _, nodename in ipairs(assert_nodes) do
|
||||||
|
if not minetest.registered_nodes[nodename] then
|
||||||
|
error("Node not present: " .. nodename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- write success flag
|
||||||
|
local data = minetest.write_json({ success = true }, true);
|
||||||
|
file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
|
||||||
|
if file then
|
||||||
|
file:write(data)
|
||||||
|
file:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.log("warning", "[technic] integration tests done!")
|
||||||
|
minetest.request_shutdown("success")
|
||||||
|
end)
|
||||||
|
end)
|
Loading…
x
Reference in New Issue
Block a user