From a5d5ea510a495da3a4b38c2375c8634f6aa4213e Mon Sep 17 00:00:00 2001 From: Telan <13066272+TheElan@users.noreply.github.com> Date: Sun, 21 Nov 2021 20:06:39 +0200 Subject: [PATCH] ci: workaround server crash not resulting in gradle error; add step to check generated crash report --- .github/scripts/test-crash-reports.sh | 9 +++++++++ .github/workflows/toolchain-compatibility.yml | 12 +++++++----- src/main/java/com/myname/mymodid/CommonProxy.java | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 .github/scripts/test-crash-reports.sh diff --git a/.github/scripts/test-crash-reports.sh b/.github/scripts/test-crash-reports.sh new file mode 100644 index 0000000..c67e342 --- /dev/null +++ b/.github/scripts/test-crash-reports.sh @@ -0,0 +1,9 @@ +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/workflows/toolchain-compatibility.yml b/.github/workflows/toolchain-compatibility.yml index e306095..612de52 100644 --- a/.github/workflows/toolchain-compatibility.yml +++ b/.github/workflows/toolchain-compatibility.yml @@ -31,10 +31,12 @@ jobs: - name: Build the mod run: ./gradlew build - - name: Run server with mod + - name: Try running server timeout-minutes: 1 - run: ./gradlew runServer + run: | + mkdir run + echo "eula=true" > run/eula.txt + ./gradlew runServer - - name: Run client with mod - timeout-minutes: 1 - run: ./gradlew runClient + - name: Test if any crash reports are present + run: .github/scripts/test-crash-reports.sh diff --git a/src/main/java/com/myname/mymodid/CommonProxy.java b/src/main/java/com/myname/mymodid/CommonProxy.java index 5c5ef7d..ae3b6b1 100644 --- a/src/main/java/com/myname/mymodid/CommonProxy.java +++ b/src/main/java/com/myname/mymodid/CommonProxy.java @@ -8,7 +8,7 @@ public class CommonProxy { // etc, and register them with the GameRegistry." public void preInit(FMLPreInitializationEvent event) { Config.syncronizeConfiguration(event.getSuggestedConfigurationFile()); - + if(true) throw new RuntimeException("test"); MyMod.info(Config.greeting); MyMod.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION + " and group name " + Tags.GROUPNAME); } @@ -43,4 +43,4 @@ public class CommonProxy { public void serverStopped(FMLServerStoppedEvent event) { } -} \ No newline at end of file +}