I have found an issue where the modloader download logic breaks down when used in a non-ephemeral environment and trying to run tests on both Forge and Fabric. This was discovered when switching from a Github Hosted Runner to a Self-Hosted Gitlab Runner.
What Happens:
- First (for this example Fabric) run begins
$HOME/.minecraft/versions/{0}/{1}.json does not exist
- Downloader runs
- Below folders get created and populated with relevant files:
a. .minecraft/versions/{0}/
b. .minecraft/versions/.*fabric.*/
- First test runs successfully (for this example we will use Fabric)
- Second (for this example Forge) run begins
$HOME/.minecraft/versions/{0}/{1}.json DOES exist
a. It was created as part of Fabric run
- Downloader does NOT run
- Below folder does NOT get created and populated
a. .minecraft/versions/.*forge.*/
- Test fails due to
Couldn't find object for regex '.*forge.*'!
Below is the line where this ultimately occurs:
|
if [ ! -f "$HOME/.minecraft/versions/${{ inputs.mc }}/${{ inputs.mc }}.json" ]; then |
A mediocre solution would be to use the input.modloader as well to check for the relevant modloader on top of the existence of the mc version folder. ie:
if [ ! -f "$HOME/.minecraft/versions/${{ inputs.mc }}/${{ inputs.mc }}.json" ]; then
java -jar headlessmc-launcher-${{ inputs.hmc-version }}.jar --command download ${{ inputs.mc }}
fi
if [[ ! -n "$(ls -d $HOME/.minecraft/versions/*${{ inputs.modloader }}*)" ]]; then
java -jar headlessmc-launcher-${{ inputs.hmc-version }}.jar --command ${{ inputs.modloader }} ${{ inputs.mc }} --java ${{ inputs.java }}
fi
This would then still present issues with using multiple versions though ie.
- Run with Forge/Fabric x.x.1 and have the below folders and their files leftover:
a. x.x.1/
b. x.x.1-forge-x.x.1/
c. fabric-loader-x.x.1-x.x.1
- Run on version fabric x.x.2
- Check for existence of
x.x.2.json, doesn't exist, download x.x.2
- Check for existence of
*fabric*, already exists in form fabric-loader-x.x.1-x.x.1, doesn't download x.x.2
- Failure due to incorrect fabric loader version for x.x.2
I am sure there is a more elegant solution that would cover all cases, I just wanted to get it documented.
I have found an issue where the modloader download logic breaks down when used in a non-ephemeral environment and trying to run tests on both Forge and Fabric. This was discovered when switching from a Github Hosted Runner to a Self-Hosted Gitlab Runner.
What Happens:
$HOME/.minecraft/versions/{0}/{1}.jsondoes not exista.
.minecraft/versions/{0}/b.
.minecraft/versions/.*fabric.*/$HOME/.minecraft/versions/{0}/{1}.jsonDOES exista. It was created as part of Fabric run
a.
.minecraft/versions/.*forge.*/Couldn't find object for regex '.*forge.*'!Below is the line where this ultimately occurs:
mc-runtime-test/action.yml
Line 93 in 398830d
A mediocre solution would be to use the
input.modloaderas well to check for the relevant modloader on top of the existence of the mc version folder. ie:This would then still present issues with using multiple versions though ie.
a.
x.x.1/b.
x.x.1-forge-x.x.1/c.
fabric-loader-x.x.1-x.x.1x.x.2.json, doesn't exist, downloadx.x.2*fabric*, already exists in formfabric-loader-x.x.1-x.x.1, doesn't downloadx.x.2I am sure there is a more elegant solution that would cover all cases, I just wanted to get it documented.