Skip to content

Commit

Permalink
ci test 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Aug 22, 2024
1 parent 9ca39ff commit d92e186
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 43 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/1.12.2.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 0 additions & 40 deletions .github/workflows/forge-1.12.2-pr.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/xaeroplus/XaeroPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import xaeroplus.module.ModuleManager;
import xaeroplus.settings.XaeroPlusSettingRegistry;
import xaeroplus.util.Globals;
import xaeroplus.util.XaeroPlusGameTest;

@Mod(
modid = XaeroPlus.MODID,
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/xaeroplus/util/XaeroPlusGameTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit d92e186

Please sign in to comment.