add integration test with sqlite db

This commit is contained in:
BuckarooBanzay 2020-04-14 14:06:41 +02:00
parent 6633dfacdb
commit 4d5537ba28
8 changed files with 52 additions and 5 deletions

View File

@ -8,9 +8,14 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- name: integration-test
run: ./integration-test.sh
- name: docker publish - name: docker publish
uses: elgohr/Publish-Docker-Github-Action@master uses: elgohr/Publish-Docker-Github-Action@master
with: with:
@ -19,4 +24,3 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
tag_names: true tag_names: true
cache: true cache: true

15
.github/workflows/integration-test.yml vendored Normal file
View File

@ -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

5
.gitignore vendored
View File

@ -1,9 +1,10 @@
.releasetoken .releasetoken
mapserver mapserver
world.mt mapserver_mod
./world.mt
output output
test-output test-output
map.sqlite ./map.sqlite
mapserver.tiles mapserver.tiles
mapserver.sqlite mapserver.sqlite
mapserver.sqlite-journal mapserver.sqlite-journal

View File

@ -13,8 +13,8 @@ RUN apk --no-cache add ca-certificates curl
WORKDIR /app WORKDIR /app
COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver
HEALTHCHECK --interval=15s --timeout=3s \ HEALTHCHECK --interval=5s --timeout=3s \
CMD curl -f http://localhost:8080/ || exit 1 CMD curl -f http://localhost:8080/api/config || exit 1
EXPOSE 8080 EXPOSE 8080
CMD ["/bin/mapserver"] CMD ["/bin/mapserver"]

Binary file not shown.

View File

@ -0,0 +1,5 @@
gameid = minetest
backend = sqlite3
creative_mode = false
enable_damage = false
player_backend = files

21
integration-test.sh Executable file
View File

@ -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 !</dev/tcp/localhost/8080; do sleep 1; done;'
curl http://127.0.0.1:8080/api/tile/0/0/0/0 > tile.png
file tile.png | grep "PNG image data" || exit 1

View File

@ -4,6 +4,7 @@ Minetest mapserver
![](https://github.com/minetest-mapserver/mapserver/workflows/jshint/badge.svg) ![](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/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 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) ![GitHub repo size](https://img.shields.io/github/repo-size/minetest-mapserver/mapserver.svg)