diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fcfa8e4..ac6dbc4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,9 +8,14 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@master + + - name: integration-test + run: ./integration-test.sh + - name: docker publish uses: elgohr/Publish-Docker-Github-Action@master with: @@ -19,4 +24,3 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} tag_names: true cache: true - diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 0000000..dc9085f --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,15 @@ +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: ./integration-test.sh diff --git a/.gitignore b/.gitignore index 563abfb..3647224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ .releasetoken mapserver -world.mt +mapserver_mod +./world.mt output test-output -map.sqlite +./map.sqlite mapserver.tiles mapserver.sqlite mapserver.sqlite-journal diff --git a/Dockerfile b/Dockerfile index 4e76446..5252f27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ RUN apk --no-cache add ca-certificates curl WORKDIR /app COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver -HEALTHCHECK --interval=15s --timeout=3s \ - CMD curl -f http://localhost:8080/ || exit 1 +HEALTHCHECK --interval=5s --timeout=3s \ + CMD curl -f http://localhost:8080/api/config || exit 1 EXPOSE 8080 CMD ["/bin/mapserver"] diff --git a/integration-test-world/map.sqlite b/integration-test-world/map.sqlite new file mode 100644 index 0000000..35dc1e8 Binary files /dev/null and b/integration-test-world/map.sqlite differ diff --git a/integration-test-world/world.mt b/integration-test-world/world.mt new file mode 100644 index 0000000..250e777 --- /dev/null +++ b/integration-test-world/world.mt @@ -0,0 +1,5 @@ +gameid = minetest +backend = sqlite3 +creative_mode = false +enable_damage = false +player_backend = files diff --git a/integration-test.sh b/integration-test.sh new file mode 100755 index 0000000..0c98aad --- /dev/null +++ b/integration-test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# build +docker build . -t mapserver + +docker run --name mapserver --rm \ + --network host \ + -v $(pwd)/integration-test-world:/app \ + mapserver & + +function cleanup { + # cleanup + docker stop mapserver +} + +trap cleanup EXIT + +bash -c 'while ! tile.png +file tile.png | grep "PNG image data" || exit 1 diff --git a/readme.md b/readme.md index f981132..d89eed8 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,7 @@ Minetest mapserver ![](https://github.com/minetest-mapserver/mapserver/workflows/jshint/badge.svg) ![](https://github.com/minetest-mapserver/mapserver/workflows/go-test/badge.svg) +![](https://github.com/minetest-mapserver/mapserver/workflows/integration-test/badge.svg) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/minetest-mapserver/mapserver) ![GitHub repo size](https://img.shields.io/github/repo-size/minetest-mapserver/mapserver.svg)