Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
fix runserver (#18)
Browse files Browse the repository at this point in the history
* fix runserver

* needs decop
  • Loading branch information
bombcar authored Feb 16, 2022
1 parent 34f8d8f commit 9e3ad3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/usr/bin/env bash

RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"

# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array (don't forget to double-quote variables expansion
crash_reports=( "$RUNDIR/$CRASH/crash"*.txt )

# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)

# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
Expand All @@ -19,21 +24,22 @@ fi

if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:'
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi

if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' "$SERVERLOG"; then
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi

if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ jobs:
run: chmod +x gradlew

- name: Setup the workspace
run: ./gradlew setupCIWorkspace
run: ./gradlew setupDecompWorkspace

- name: Build the mod
run: ./gradlew build

- name: Run server for 1.5 minutes
- name: Run server for 4 minutes
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true
timeout 240 ./gradlew runServer 2>&1 | tee -a server.log || true
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test-no-error-reports.sh
.github/scripts/test-no-error-reports.sh
chmod +x .github/scripts/test_no_error_reports
.github/scripts/test_no_error_reports

0 comments on commit 9e3ad3d

Please sign in to comment.