ci: Added testing step to github actions

This commit is contained in:
Geoff Bourne 2020-07-11 14:09:08 -05:00
parent 5e75410e7c
commit 367c6cfd92
4 changed files with 44 additions and 7 deletions

View File

@ -16,7 +16,18 @@ on:
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
tests/test.sh
build:
needs:
- test
runs-on: ubuntu-latest
steps:

View File

@ -5,15 +5,12 @@ on:
branches: [ master ]
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
uses: docker/build-push-action@v1.1.0
with:
tag_with_sha: true
cache_froms: itzg/minecraft-server:latest
push: false
- name: Run tests
run: |
tests/test.sh

View File

@ -0,0 +1,16 @@
version: "3.8"
services:
sut:
depends_on:
- mc
image: itzg/mc-monitor:0.6.0
command: status --host mc --retry-interval 1s --retry-limit 120
mc:
build:
context: ..
cache_from:
- itzg/minecraft-server:latest
environment:
EULA: "TRUE"

13
tests/test.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
cd $(dirname $0)
failed=false
args="-f docker-compose.test.yml"
docker-compose $args run sut || failed=true; docker-compose $args logs mc
docker-compose $args down -v
if $failed; then
exit 1
fi