diff options
author | bombcar <github@bombcar.com> | 2022-02-15 14:21:08 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 21:21:08 +0100 |
commit | f6a7c3421168b95c2d61a6314206f4bd2eea2297 (patch) | |
tree | e579aa901f235d7e06446914c34f9e71b4ad6776 /.github | |
parent | e28ccb5d6b678245c2f78f910e6c39aa29fb3793 (diff) | |
download | GT5-Unofficial-f6a7c3421168b95c2d61a6314206f4bd2eea2297.tar.gz GT5-Unofficial-f6a7c3421168b95c2d61a6314206f4bd2eea2297.tar.bz2 GT5-Unofficial-f6a7c3421168b95c2d61a6314206f4bd2eea2297.zip |
update buildscripts (#132)
* update buildscripts
* notabs:
* newline
* tabs
* shellcheck
Diffstat (limited to '.github')
-rw-r--r-- | .github/scripts/test-no-crash-reports.sh | 9 | ||||
-rwxr-xr-x | .github/scripts/test-no-error-reports.sh | 45 | ||||
-rw-r--r-- | .github/workflows/build-and-test.yml | 20 |
3 files changed, 55 insertions, 19 deletions
diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh deleted file mode 100644 index c67e342c06..0000000000 --- a/.github/scripts/test-no-crash-reports.sh +++ /dev/null @@ -1,9 +0,0 @@ -directory="run/crash-reports" -if [ -d $directory ]; then - echo "Crash reports detected:" - cat $directory/* - exit 1 -else - echo "No crash reports detected" - exit 0 -fi diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh new file mode 100755 index 0000000000..cfce0261a5 --- /dev/null +++ b/.github/scripts/test-no-error-reports.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +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 ) +if [ "${#crash_reports[@]}" -gt 0 ]; then + latest_crash_report="${crash_reports[-1]}" + { + printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" + cat "$latest_crash_report" + } >&2 + exit 1 +fi + +if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then + { + printf 'Fatal errors detected:' + 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 + { + printf 'Server force stopped:' + cat server.log + } >&2 + exit 1 +fi + +if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then + { + printf 'Server did not finish startup:' + cat server.log + } >&2 + exit 1 +fi + +printf 'No crash reports detected' +exit 0 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a60a2b6468..2a74327ad6 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -14,32 +14,32 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: + with: fetch-depth: 0 - + - name: Set up JDK 8 uses: actions/setup-java@v2 with: java-version: '8' distribution: 'adopt' cache: gradle - + - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Setup the workspace run: ./gradlew setupCIWorkspace - + - name: Build the mod run: ./gradlew build - - name: Run server for 1 minute + - name: Run server for 1.5 minutes run: | mkdir run - echo "eula=true" > run/eula.txt - timeout 60 ./gradlew runServer || true + echo "eula=true" > run/eula.txt + timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true - - name: Test no crashes happend + - name: Test no errors reported during server run run: | - chmod +x .github/scripts/test-no-crash-reports.sh - .github/scripts/test-no-crash-reports.sh + chmod +x .github/scripts/test-no-error-reports.sh + .github/scripts/test-no-error-reports.sh |