mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-24 17:50:40 +01:00
Migrate tests to new Docker image
This commit is contained in:
parent
045c7510bf
commit
41efbaf210
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@ -3,9 +3,15 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Unittests"
|
||||
name: "Unit Tests"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'minetest/minetest_game'
|
||||
path: minetest_game
|
||||
|
||||
- name: Run tests
|
||||
run: MINETEST_VER=latest ./.util/run_tests.sh
|
||||
run: ./.util/run_tests.sh --docker
|
||||
|
@ -1,29 +1,38 @@
|
||||
#!/bin/bash
|
||||
tempdir=/tmp/mt
|
||||
tempdir=$(mktemp -d)
|
||||
confpath=$tempdir/minetest.conf
|
||||
worldpath=$tempdir/world
|
||||
trap 'rm -rf "$tempdir"' EXIT
|
||||
|
||||
use_docker=y
|
||||
[ -x ../../bin/minetestserver ] && use_docker=
|
||||
[ -f worldedit/mod.conf ] || { echo "Must be run in modpack root folder." >&2; exit 1; }
|
||||
|
||||
rm -rf $tempdir
|
||||
mkdir -p $worldpath
|
||||
# the docker image doesn't have devtest
|
||||
[ -n "$use_docker" ] || printf '%s\n' gameid=devtest >$worldpath/world.mt
|
||||
mtserver=
|
||||
if [ "$1" == "--docker" ]; then
|
||||
command -v docker >/dev/null || { echo "Docker is not installed." >&2; exit 1; }
|
||||
[ -d minetest_game ] || { echo "To run the test with Docker, a source checkout of minetest_game is required." >&2; exit 1; }
|
||||
else
|
||||
mtserver=$(command -v minetestserver)
|
||||
[[ -z "$mtserver" && -x ../../bin/minetestserver ]] && mtserver=../../bin/minetestserver
|
||||
[ -z "$mtserver" ] && { echo "To run the test outside of Docker, an installation of minetestserver is required." >&2; exit 1; }
|
||||
fi
|
||||
|
||||
mkdir $worldpath
|
||||
printf '%s\n' mg_name=singlenode '[end_of_params]' >$worldpath/map_meta.txt
|
||||
printf '%s\n' worldedit_run_tests=true max_forceloaded_blocks=9999 >$confpath
|
||||
printf '%s\n' worldedit_run_tests=true >$confpath
|
||||
|
||||
if [ -n "$use_docker" ]; then
|
||||
if [ -z "$mtserver" ]; then
|
||||
chmod -R 777 $tempdir
|
||||
[ -z "$DOCKER_IMAGE" ] && DOCKER_IMAGE="ghcr.io/minetest/minetest:master"
|
||||
docker run --rm -i \
|
||||
-v $confpath:/etc/minetest/minetest.conf \
|
||||
-v $tempdir:/var/lib/minetest/.minetest \
|
||||
-v "$confpath":/etc/minetest/minetest.conf \
|
||||
-v "$tempdir":/var/lib/minetest/.minetest \
|
||||
-v "$PWD/minetest_game":/var/lib/minetest/.minetest/games/minetest_game \
|
||||
-v "$PWD/worldedit":/var/lib/minetest/.minetest/world/worldmods/worldedit \
|
||||
registry.gitlab.com/minetest/minetest/server:${MINETEST_VER}
|
||||
"$DOCKER_IMAGE"
|
||||
else
|
||||
mkdir $worldpath/worldmods
|
||||
ln -s "$PWD/worldedit" $worldpath/worldmods/worldedit
|
||||
../../bin/minetestserver --config $confpath --world $worldpath --logfile /dev/null
|
||||
$mtserver --config "$confpath" --world "$worldpath" --logfile /dev/null
|
||||
fi
|
||||
|
||||
test -f $worldpath/tests_ok || exit 1
|
||||
|
@ -560,7 +560,7 @@ worldedit.run_tests = function()
|
||||
for x = 0, math.floor(wanted.x/16) do
|
||||
for y = 0, math.floor(wanted.y/16) do
|
||||
for z = 0, math.floor(wanted.z/16) do
|
||||
assert(minetest.forceload_block(vector.new(x*16, y*16, z*16), true))
|
||||
assert(minetest.forceload_block(vector.new(x*16, y*16, z*16), true, -1))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user