From fb3beeb4db1e40a1f7c8372969209a40aae925fd Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:27:18 +0200 Subject: [PATCH 1/9] ci-persist-server-log-in-test-run --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a60a2b6..c34a6ad 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -37,7 +37,7 @@ jobs: run: | mkdir run echo "eula=true" > run/eula.txt - timeout 60 ./gradlew runServer || true + timeout 60 ./gradlew runServer | tee --append server.log || true - name: Test no crashes happend run: | From f795717040805bea5e5991b737df007804dc90cb Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:34:41 +0200 Subject: [PATCH 2/9] add more checks for server not working --- .github/scripts/test-no-crash-reports.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh index c67e342..73fa6ca 100755 --- a/.github/scripts/test-no-crash-reports.sh +++ b/.github/scripts/test-no-crash-reports.sh @@ -1,9 +1,22 @@ directory="run/crash-reports" -if [ -d $directory ]; then +if [[ -d $directory ]]; then echo "Crash reports detected:" cat $directory/* exit 1 -else - echo "No crash reports detected" - exit 0 fi + +if [[ grep --quiet "Fatal errors were detected" server.log ]]; then + echo "Fatal errors detected:" + cat server.log + exit 1 +fi + +if [[ grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log ]]; then + echo "Server force stopped:" + cat server.log + exit 1 +fi + +echo "No crash reports detected" +exit 0 + From 74d9da327a6fa985b88735aa78299d1dc8c6d42a Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:36:34 +0200 Subject: [PATCH 3/9] ci: increase server running period during tests --- .github/workflows/build-and-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c34a6ad..0556aee 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -33,13 +33,13 @@ jobs: - name: Build the mod run: ./gradlew build - - name: Run server for 1 minute + - name: Run server for 5 minutes run: | mkdir run echo "eula=true" > run/eula.txt - timeout 60 ./gradlew runServer | tee --append server.log || true + timeout 300 ./gradlew runServer | tee --append 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 + .github/scripts/test-no-error-reports.sh From 5e0f711012b181830a95de03e7359602175b65fa Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:37:13 +0200 Subject: [PATCH 4/9] ci: rename report checking script --- .../{test-no-crash-reports.sh => test-no-error-reports.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/scripts/{test-no-crash-reports.sh => test-no-error-reports.sh} (100%) diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-error-reports.sh similarity index 100% rename from .github/scripts/test-no-crash-reports.sh rename to .github/scripts/test-no-error-reports.sh From 4df1f2f3d5f3969cf7e1c988ddd7e7b7c6faee45 Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:37:44 +0200 Subject: [PATCH 5/9] ci: refine scripts --- .github/scripts/test-no-error-reports.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh index 73fa6ca..85dbd3f 100755 --- a/.github/scripts/test-no-error-reports.sh +++ b/.github/scripts/test-no-error-reports.sh @@ -1,5 +1,4 @@ -directory="run/crash-reports" -if [[ -d $directory ]]; then +if [[ -d "run/crash-reports" ]]; then echo "Crash reports detected:" cat $directory/* exit 1 From 027521c6d25cf6ab01c81c63cdbc82a441824785 Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:39:33 +0200 Subject: [PATCH 6/9] ci: fix script syntax --- .github/scripts/test-no-error-reports.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh index 85dbd3f..26fd866 100755 --- a/.github/scripts/test-no-error-reports.sh +++ b/.github/scripts/test-no-error-reports.sh @@ -4,13 +4,13 @@ if [[ -d "run/crash-reports" ]]; then exit 1 fi -if [[ grep --quiet "Fatal errors were detected" server.log ]]; then +if grep --quiet "Fatal errors were detected" server.log; then echo "Fatal errors detected:" cat server.log exit 1 fi -if [[ grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log ]]; then +if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then echo "Server force stopped:" cat server.log exit 1 From bec70198b84e10f28ad5776d71233d8b6ff16535 Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:51:02 +0200 Subject: [PATCH 7/9] fix workflow referencing moved file --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0556aee..ded69fa 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -41,5 +41,5 @@ jobs: - name: Test no errors reported during server run run: | - chmod +x .github/scripts/test-no-crash-reports.sh + chmod +x .github/scripts/test-no-error-reports.sh .github/scripts/test-no-error-reports.sh From 71fb844748c4930b8e80f8c211a0309517522d31 Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:52:20 +0200 Subject: [PATCH 8/9] ci: decrease server run time in test --- .github/workflows/build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ded69fa..2199c24 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -33,11 +33,11 @@ jobs: - name: Build the mod run: ./gradlew build - - name: Run server for 5 minutes + - name: Run server for 1.5 minutes run: | mkdir run echo "eula=true" > run/eula.txt - timeout 300 ./gradlew runServer | tee --append server.log || true + timeout 90 ./gradlew runServer | tee --append server.log || true - name: Test no errors reported during server run run: | From e8824913850ef6b578ba73e35478691f546bd820 Mon Sep 17 00:00:00 2001 From: Dmytro <13066272+TheElan@users.noreply.github.com> Date: Mon, 13 Dec 2021 16:08:07 +0200 Subject: [PATCH 9/9] add startup finish check --- .github/scripts/test-no-error-reports.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh index 26fd866..e387660 100755 --- a/.github/scripts/test-no-error-reports.sh +++ b/.github/scripts/test-no-error-reports.sh @@ -16,6 +16,12 @@ if grep --quiet "The state engine was in incorrect state ERRORED and forced into exit 1 fi +if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then + echo "Server didn't finish startup:" + cat server.log + exit 1 +fi + echo "No crash reports detected" exit 0