Skip to content

Commit

Permalink
Run tests on older MT too
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Mar 25, 2024
1 parent 41efbaf commit 27cfb33
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ jobs:
test:
name: "Unit Tests"
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
DOCKER_IMAGE:
- registry.gitlab.com/minetest/minetest/server:5.5.1
- "" # latest master
steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: 'minetest/minetest_game'
path: minetest_game
if: "${{ matrix.DOCKER_IMAGE }} != ''"

- name: Run tests
run: ./.util/run_tests.sh --docker
env:
DOCKER_IMAGE: "${{ matrix.DOCKER_IMAGE }}"
17 changes: 10 additions & 7 deletions .util/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,12 +23,15 @@ printf '%s\n' worldedit_run_tests=true >$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
Expand Down

0 comments on commit 27cfb33

Please sign in to comment.