Run tests on older MT too

This commit is contained in:
sfan5 2024-03-25 17:11:00 +01:00
parent eac05e3133
commit 575bfca67a
2 changed files with 21 additions and 9 deletions

@ -3,8 +3,14 @@ on: [push, pull_request]
jobs:
test:
name: "Unit Tests"
name: "Unit Tests ${{ matrix.cfg.image }}"
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
cfg:
- { image: 'registry.gitlab.com/minetest/minetest/server:5.5.1', mtg: false }
- { image: '', mtg: true } # latest mater
steps:
- uses: actions/checkout@v4
@ -12,6 +18,9 @@ jobs:
with:
repository: 'minetest/minetest_game'
path: minetest_game
if: ${{ matrix.cfg.mtg }}
- name: Run tests
run: ./.util/run_tests.sh --docker
env:
DOCKER_IMAGE: "${{ matrix.cfg.image }}"

@ -9,7 +9,7 @@ trap 'rm -rf "$tempdir"' EXIT
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; }
[ -d minetest_game ] || echo "A source checkout of minetest_game was not found. This can fail if your docker image does not ship a game." >&2;
else
mtserver=$(command -v minetestserver)
[[ -z "$mtserver" && -x ../../bin/minetestserver ]] && mtserver=../../bin/minetestserver
@ -18,17 +18,20 @@ fi
mkdir $worldpath
printf '%s\n' mg_name=singlenode '[end_of_params]' >$worldpath/map_meta.txt
printf '%s\n' worldedit_run_tests=true >$confpath
printf '%s\n' worldedit_run_tests=true max_forceloaded_blocks=9999 >$confpath
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 "$PWD/minetest_game":/var/lib/minetest/.minetest/games/minetest_game \
-v "$PWD/worldedit":/var/lib/minetest/.minetest/world/worldmods/worldedit \
"$DOCKER_IMAGE"
vol=(
-v "$confpath":/etc/minetest/minetest.conf
-v "$tempdir":/var/lib/minetest/.minetest
-v "$PWD/worldedit":/var/lib/minetest/.minetest/world/worldmods/worldedit
)
[ -d minetest_game ] && vol+=(
-v "$PWD/minetest_game":/var/lib/minetest/.minetest/games/minetest_game
)
docker run --rm -i "${vol[@]}" "$DOCKER_IMAGE"
else
mkdir $worldpath/worldmods
ln -s "$PWD/worldedit" $worldpath/worldmods/worldedit