GitHub Action
Mc-Runtime-Test
Warning
NOT AN OFFICIAL MINECRAFT PRODUCT. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.
This action runs the Minecraft client inside your CI/CD pipeline.
When coding Minecraft mods many bugs can only be caught at runtime. Between many different versions and modloaders manual testing becomes laborious. Additionally, many (e.g. mapping or mixin related) bugs only occur when running against a Minecraft instance that has been launched by a launcher, instead of some IDE or gradle task.
This action runs the Minecraft client using the HeadlessMC launcher, which patches the lwjgl library so that the game can run headlessly. It also provides mods for several versions, which all do one thing: join a single-player world, wait for chunks to load, and then quit the game after a few seconds. This way you can already run simple boot tests, checking whether the game will boot with your mod.
Mc-Runtime-Test currently supports the following Minecraft versions and modloaders:
Version | Forge | Fabric | NeoForge |
---|---|---|---|
1.20.2 - 1.20.4 | ✅ | ✅ | ✅ |
1.20.1 | ✅ | ✅ | |
1.19 - 1.19.4 | ✅ | ✅ | - |
1.18.2 | ✅ | ✅ | - |
1.17.1 | ✅ | ✅ | - |
1.16.5 | ✅ | ✅ | - |
1.12.2 | ✅ | - | |
1.8.9 | ✅ | - | |
1.7.18 | ✅ | - |
Versions marked with
name: Run the MC client
on:
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
# ... run actions to build your client
# Copy the jar that you build to the mods folder
- name: Copy mod jar to mods
run: cp -r build/libs/your-mod.jar run/mods/
# Call this Action to run the client
- name: Run the MC client
uses: 3arthqu4ke/mc-runtime-test@v1
with:
mc: 1.20.4
modloader: fabric
regex: .*fabric.*
java: 17
mc
: The MC version to use, e.g.1.20.4
.modloader
: The modloader to install with HeadlessMC (forge
,neoforge
orfabric
).regex
: A Regex to match the MC version to launch (can in most cases just be.*<modloader>.*
, like.*fabric.*
, very old versions of forge might start with an uppercaseForge
).java
: The Java version to use, e.g.17
, we use the adopt distribution.dummy_assets
: HeadlessMC will use dummy assets to not download all the MC assets. Can be disabled by setting this tofalse
.mc_runtime_test
: The MC-Runtime-Test jar to download (none
,lexforge
,fabric
orneoforge
). When usingnone
you need to provide a way for the game to exit or the action will run indefinitely and time out.
MC-Runtime-Test does not provide a framework for proper game tests (yet?).
With the mc-runtime-test mod jars you can only test if your game can boot into a world.
To write your own tests you need to build a mod that contains some form of tests, e.g. checking some value each tick, and put that jar in run/mods
inside your workflow.
One idea for to help with this be to use a @Pseudo mixin on the McRuntimeTest class.