mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
commit
83f6cebd0b
11
.github/workflows/main.yml
vendored
11
.github/workflows/main.yml
vendored
@ -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:
|
||||
|
11
.github/workflows/pr.yml
vendored
11
.github/workflows/pr.yml
vendored
@ -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
|
||||
|
@ -62,8 +62,12 @@ function downloadSpigot {
|
||||
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
|
||||
fi
|
||||
|
||||
if [ -f $SERVER ]; then
|
||||
# tell curl to only download when newer
|
||||
zarg="-z $SERVER"
|
||||
fi
|
||||
log "Downloading $match from $downloadUrl ..."
|
||||
curl -fsSL -o $SERVER "$downloadUrl"
|
||||
curl -fsSL -o $SERVER $zarg "$downloadUrl"
|
||||
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
|
||||
cat <<EOF
|
||||
|
||||
@ -89,12 +93,12 @@ case "$TYPE" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
||||
buildSpigotFromSource
|
||||
else
|
||||
downloadSpigot
|
||||
fi
|
||||
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
||||
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||
buildSpigotFromSource
|
||||
fi
|
||||
else
|
||||
downloadSpigot
|
||||
fi
|
||||
|
||||
# Normalize on Spigot for operations below
|
||||
|
@ -5,17 +5,18 @@
|
||||
: ${PAPERBUILD:=latest}
|
||||
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
||||
|
||||
if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
|
||||
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
|
||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||
if [ ! -f "$SERVER" ]; then
|
||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||
exit 3
|
||||
fi
|
||||
if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
|
||||
zarg="-z '$SERVER'"
|
||||
fi
|
||||
|
||||
# Normalize on Spigot for operations below
|
||||
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
|
||||
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
|
||||
if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl"; then
|
||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Normalize on Spigot for downstream operations
|
||||
export TYPE=SPIGOT
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
|
||||
|
17
tests/docker-compose.test.yml
Normal file
17
tests/docker-compose.test.yml
Normal file
@ -0,0 +1,17 @@
|
||||
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:
|
||||
restart: "no"
|
||||
build:
|
||||
context: ..
|
||||
cache_from:
|
||||
- itzg/minecraft-server:latest
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
|
17
tests/test.sh
Executable file
17
tests/test.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
failed=false
|
||||
args="-f docker-compose.test.yml"
|
||||
docker-compose $args run sut || failed=true
|
||||
echo "
|
||||
Result: failed=$failed"
|
||||
|
||||
$failed && docker-compose $args logs mc
|
||||
docker-compose $args down -v
|
||||
|
||||
if $failed; then
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user