From d92e1864e8d58c739cd9c1818a6a5a39301074e3 Mon Sep 17 00:00:00 2001 From: rfresh2 <89827146+rfresh2@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:30:14 -0700 Subject: [PATCH] ci test 1.12 --- .github/workflows/1.12.2.yml | 67 +++++++++++++++++++ .github/workflows/forge-1.12.2-pr.yml | 40 ----------- .github/workflows/gradle.yml | 5 +- src/main/java/xaeroplus/XaeroPlus.java | 4 ++ .../xaeroplus/util/XaeroPlusGameTest.java | 21 ++++++ 5 files changed, 94 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/1.12.2.yml delete mode 100644 .github/workflows/forge-1.12.2-pr.yml create mode 100644 src/main/java/xaeroplus/util/XaeroPlusGameTest.java diff --git a/.github/workflows/1.12.2.yml b/.github/workflows/1.12.2.yml new file mode 100644 index 00000000..d37634b3 --- /dev/null +++ b/.github/workflows/1.12.2.yml @@ -0,0 +1,67 @@ +name: 1.12.2 Build + +on: + pull_request: + push: + branches: + - "ci-test-1.12" + +env: + WORLDMAP_VERSION: "1.38.8" + MINIMAP_VERSION: "24.3.0" + MINECRAFT_VERSION: "1.12.2" + MINECRAFT_VERSION_SHORT: "1.12" + MOD_LOADER: "Forge" + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Gradle Wrapper Verification + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + + - name: Elevate wrapper permissions + run: chmod +x ./gradlew + + - name: Build mod + run: ./gradlew build + + - name: Rename built mod + run: mv build/libs/xaeroplus-${{ env.MINECRAFT_VERSION }}.jar XaeroPlus-${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.run_number }}-WM${{ env.WORLDMAP_VERSION }}-MM${{ env.MINIMAP_VERSION }}.jar + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.run_number }}-WM${{ env.WORLDMAP_VERSION }}-MM${{ env.MINIMAP_VERSION }} + path: XaeroPlus-${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.run_number }}-WM${{ env.WORLDMAP_VERSION }}-MM${{ env.MINIMAP_VERSION }}.jar + + - name: Set CI Test Env Var + run: echo "XP_CI_TEST=true" >> $GITHUB_ENV + + - name: Setup Forge Test + run: | + mkdir -p run/mods && cp XaeroPlus-${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.run_number }}-WM${{ env.WORLDMAP_VERSION }}-MM${{ env.MINIMAP_VERSION }}.jar run/mods \ + && wget https://api.modrinth.com/maven/maven/modrinth/xaeros-minimap/${{ env.MINIMAP_VERSION }}_Forge_1.12/xaeros-minimap-${{ env.MINIMAP_VERSION }}_Forge_1.12.jar -P run/mods/ \ + && wget https://api.modrinth.com/maven/maven/modrinth/xaeros-world-map/${{ env.WORLDMAP_VERSION }}_Forge_1.12/xaeros-world-map-${{ env.WORLDMAP_VERSION }}_Forge_1.12.jar -P run/mods/ + + - name: Forge Test + uses: 3arthqu4ke/mc-runtime-test@2.3.1 + with: + mc: ${{ env.MINECRAFT_VERSION }} + modloader: forge + regex: .*forge.* + mc-runtime-test: lexforge + java: 8 + xvfb: false + headlessmc-command: -lwjgl --jvm -Djava.awt.headless=true diff --git a/.github/workflows/forge-1.12.2-pr.yml b/.github/workflows/forge-1.12.2-pr.yml deleted file mode 100644 index b777de34..00000000 --- a/.github/workflows/forge-1.12.2-pr.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Forge-1.12.2 PR Build - -on: - pull_request: - branches: - - "mainline" -env: - MINECRAFT_VERSION: "1.12.2" - MOD_LOADER: "Forge" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Gradle Wrapper Verification - uses: gradle/wrapper-validation-action@v1 - - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - - - name: Elevate wrapper permissions - run: chmod +x ./gradlew - - - name: Build mod - run: ./gradlew build - - - name: Rename built mod - run: mv build/libs/xaeroplus-${{ env.MINECRAFT_VERSION }}.jar XaeroPlus-${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.event.pull_request.head.sha }}.jar - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.event.pull_request.head.sha }} - path: XaeroPlus-${{ env.MOD_LOADER }}-${{ env.MINECRAFT_VERSION }}-${{ github.event.pull_request.head.sha }}.jar diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3655b4f9..fc886b80 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,9 +1,8 @@ name: Mainline Build And Release on: - push: - branches: - - "mainline" + workflow_dispatch: + env: WORLDMAP_VERSION: "1.38.8" MINIMAP_VERSION: "24.3.0" diff --git a/src/main/java/xaeroplus/XaeroPlus.java b/src/main/java/xaeroplus/XaeroPlus.java index 16cc78d4..01e5950c 100644 --- a/src/main/java/xaeroplus/XaeroPlus.java +++ b/src/main/java/xaeroplus/XaeroPlus.java @@ -12,6 +12,7 @@ import xaeroplus.module.ModuleManager; import xaeroplus.settings.XaeroPlusSettingRegistry; import xaeroplus.util.Globals; +import xaeroplus.util.XaeroPlusGameTest; @Mod( modid = XaeroPlus.MODID, @@ -41,6 +42,9 @@ public void preInit(FMLPreInitializationEvent event) { public void init(FMLInitializationEvent event) { EVENT_BUS.register(forgeEventHandler); LOGGER.info("XaeroPlus initialized"); + if (System.getenv("XP_CI_TEST") != null) { + XaeroPlusGameTest.applyMixinsTest(); + } } @Mod.EventHandler diff --git a/src/main/java/xaeroplus/util/XaeroPlusGameTest.java b/src/main/java/xaeroplus/util/XaeroPlusGameTest.java new file mode 100644 index 00000000..5a7e0abe --- /dev/null +++ b/src/main/java/xaeroplus/util/XaeroPlusGameTest.java @@ -0,0 +1,21 @@ +package xaeroplus.util; + +import xaero.common.gui.GuiWaypoints; +import xaero.map.gui.GuiMap; +import xaeroplus.XaeroPlus; + +public class XaeroPlusGameTest { + public static void applyMixinsTest() { + // forcing our mixins to apply by loading some classes that aren't loaded by just joining the game + try { + // todo: ideally we would iterate over every XP mixin class target and load them all + // not sure how to get a list of all mixin targets though + String a = GuiMap.class.getSimpleName(); + String b = GuiWaypoints.class.getSimpleName(); + XaeroPlus.LOGGER.info("Classload test complete"); + } catch (final Throwable e) { + XaeroPlus.LOGGER.error("Classload test failed", e); + System.exit(1); + } + } +}