diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml deleted file mode 100644 index c9dd6f5..0000000 --- a/.github/workflows/integration-test.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: integration-test - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - timeout-minutes: 10 - - steps: - - uses: actions/checkout@master - - - name: integration-test - run: ./test/integration-test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..53f6399 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: test + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + ENGINE_VERSION: [5.3.0, 5.4.0, 5.5.0, latest] + + steps: + - uses: actions/checkout@v2 + - name: test + run: docker-compose up --exit-code-from sut diff --git a/.luacheckrc b/.luacheckrc index 71b6fae..9bd0493 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -18,5 +18,5 @@ read_globals = { "unified_inventory", "default", -- optional mods - "xban", "QoS" + "xban", "QoS", "mtt" } diff --git a/README.md b/README.md index f824c98..dce43c6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Mail mod for Minetest (ingame mod) ====== -![](https://github.com/minetest-mail/mail_mod/workflows/integration-test/badge.svg) +![](https://github.com/minetest-mail/mail_mod/workflows/test/badge.svg) ![](https://github.com/minetest-mail/mail_mod/workflows/luacheck/badge.svg) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..865f083 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.6" + +services: + sut: + build: + context: ./test + args: + ENGINE_VERSION: ${ENGINE_VERSION:-5.5.0} + user: root + volumes: + - "./:/root/.minetest/worlds/world/worldmods/mail/" + - "world_data:/root/.minetest/worlds/world" + - "./test/world.mt:/root/.minetest/worlds/world/world.mt" + - "./test/minetest.conf:/minetest.conf" + ports: + - "30000:30000/udp" + +volumes: + world_data: {} \ No newline at end of file diff --git a/init.lua b/init.lua index 0f947ee..1b67e7e 100644 --- a/init.lua +++ b/init.lua @@ -64,3 +64,7 @@ end -- migrate storage mail.migrate() + +if minetest.get_modpath("mtt") then + dofile(MP .. "/mtt.lua") +end \ No newline at end of file diff --git a/mod.conf b/mod.conf index 7e9f894..e38d49b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = mail -description = mail mod -optional_depends = unified_inventory,default,xban2,qos +description = ingame mail-system +optional_depends = unified_inventory,default,xban2,qos,mtt diff --git a/mtt.lua b/mtt.lua new file mode 100644 index 0000000..61c51da --- /dev/null +++ b/mtt.lua @@ -0,0 +1,10 @@ + +mtt.register("send mail", function(callback) + -- send a mail + mail.send("player1", "player2", "something", "blah") + + -- check the receivers inbox + local list2 = mail.getMessages("player2") + assert(list2 ~= nil and #list2 > 0) + callback() +end) \ No newline at end of file diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..6324d80 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,10 @@ +ARG ENGINE_VERSION=5.5.0 +FROM registry.gitlab.com/minetest/minetest/server:${ENGINE_VERSION} + +USER root +RUN apk add git &&\ + mkdir -p /root/.minetest/worlds/world/worldmods/ &&\ + git clone https://github.com/BuckarooBanzay/mtt /root/.minetest/worlds/world/worldmods/mtt + + +ENTRYPOINT minetestserver --config /minetest.conf \ No newline at end of file diff --git a/test/auth.sqlite b/test/auth.sqlite deleted file mode 100644 index e3f8829..0000000 Binary files a/test/auth.sqlite and /dev/null differ diff --git a/test/auth.txt b/test/auth.txt deleted file mode 100644 index 9c8c6d1..0000000 --- a/test/auth.txt +++ /dev/null @@ -1,4 +0,0 @@ -User,Password ------------------ -test,enter -test2,enter diff --git a/test/integration-test.sh b/test/integration-test.sh deleted file mode 100755 index 4ec5a59..0000000 --- a/test/integration-test.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -MINETEST_VERSION=5.2.0 - -# prerequisites -jq --version || exit 1 -curl --version || exit 1 - -# ensure proper current directory -CWD=$(dirname $0) -cd ${CWD} - -# setup -unset use_proxy -unset http_proxy -unset https_proxy -unset HTTP_PROXY -unset HTTPS_PROXY - -# run mail-server -docker pull minetestmail/mail -docker run --name mail --rm \ - -e WEBMAILKEY=myserverkey \ - -e WEBMAIL_DEBUG=true \ - --network host \ - minetestmail/mail & - -# wait for startup -bash -c 'while !