forked from minetest/minetest_game
Add workflow that runs simple test with the engine present
This commit is contained in:
parent
ef788d0307
commit
316c0c7224
11
.github/workflows/test.yml
vendored
Normal file
11
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
name: test
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: ./utils/test/run.sh
|
|
@ -77,3 +77,19 @@ dofile(default_path.."/crafting.lua")
|
||||||
dofile(default_path.."/mapgen.lua")
|
dofile(default_path.."/mapgen.lua")
|
||||||
dofile(default_path.."/aliases.lua")
|
dofile(default_path.."/aliases.lua")
|
||||||
dofile(default_path.."/legacy.lua")
|
dofile(default_path.."/legacy.lua")
|
||||||
|
|
||||||
|
-- Smoke test that is run via ./util/test/run.sh
|
||||||
|
if minetest.settings:get_bool("minetest_game_smoke_test") then
|
||||||
|
minetest.after(0, function()
|
||||||
|
minetest.emerge_area(vector.new(0, 0, 0), vector.new(32, 32, 32))
|
||||||
|
local pos = vector.new(9, 9, 9)
|
||||||
|
local function check()
|
||||||
|
if minetest.get_node(pos).name ~= "ignore" then
|
||||||
|
minetest.request_shutdown()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.after(0, check)
|
||||||
|
end
|
||||||
|
check()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
1
utils/test/minetest.conf
Normal file
1
utils/test/minetest.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
minetest_game_smoke_test = true
|
19
utils/test/run.sh
Executable file
19
utils/test/run.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
world=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$world" || :' EXIT
|
||||||
|
|
||||||
|
[ -f game.conf ] || { echo "Must be run in game root folder." >&2; exit 1; }
|
||||||
|
|
||||||
|
cp -v utils/test/world.mt "$world/"
|
||||||
|
chmod -R a+rwX "$world" # needed because server runs as unprivileged user inside container
|
||||||
|
|
||||||
|
vol=(
|
||||||
|
-v "$PWD/utils/test/minetest.conf":/etc/minetest/minetest.conf
|
||||||
|
--tmpfs /var/lib/minetest/.minetest
|
||||||
|
-v "$PWD":/var/lib/minetest/.minetest/games/minetest_game
|
||||||
|
-v "$world":/var/lib/minetest/.minetest/world
|
||||||
|
)
|
||||||
|
[ -z "$DOCKER_IMAGE" ] && DOCKER_IMAGE="ghcr.io/minetest/minetest:master"
|
||||||
|
docker run --rm -i "${vol[@]}" "$DOCKER_IMAGE"
|
||||||
|
|
||||||
|
exit 0
|
7
utils/test/world.mt
Normal file
7
utils/test/world.mt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
auth_backend = sqlite3
|
||||||
|
backend = sqlite3
|
||||||
|
creative_mode = false
|
||||||
|
enable_damage = true
|
||||||
|
gameid = minetest
|
||||||
|
mod_storage_backend = sqlite3
|
||||||
|
player_backend = sqlite3
|
Loading…
Reference in New Issue
Block a user