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 facde24
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ 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

- uses: actions/checkout@v4
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 }}"
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 facde24

Please sign in to comment.