Skip to content

Commit 42ea85d

Browse files
authored
Fix 1.21 CI (#1211)
Fixes #1074 There seemed to be multiple issues here: - PAUCAL is relying on ArchitecturyAPI which was missing in the dependencies - The PAUCAL version from SuperKnux' fork previously present in the dependencies caused an error on server start - The unmapped *-shadow.jar files were copied to the mods folder together with the final mapped jar, causing the runs to non-deterministically fail depending on which file was loaded and which was ignored by the mod loader - The mc-runtime-test action expects only the major java version, so it was failing with the full major.minor.patch format I thought it was also worth reevaluating the mod caching of the testing workflow. This cache has thrown me for a loop multiple times while analyzing this issue, since the cached mods are all the mods present in the run/mods folder, not just the ones downloaded from the dependencies.txt. One possible way to avoid this would be to split the cache action call up into cache/restore and cache/save, saving the cache right after the dependency download instead of at the end of the job. I've included this solution into this PR, but feel free to let me know if this is not something you want. Hexdoc still doesn't work, but this is tracked separately in #1072
1 parent 46a16fc commit 42ea85d

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/pr.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
branches: indev/1.21.1
1313

1414
env:
15-
JAVA_VERSION: '21.0.5'
15+
JAVA_VERSION: '21'
1616

1717
jobs:
1818
build:
@@ -62,12 +62,13 @@ jobs:
6262
dependencies: >-
6363
'https://cdn.modrinth.com/data/Ha28R6CL/versions/2i87JpYj/fabric-language-kotlin-1.13.11%2Bkotlin.2.3.21.jar'
6464
'https://cdn.modrinth.com/data/9s6osm5g/versions/HpMb5wGb/cloth-config-15.0.140-fabric.jar'
65-
'https://github.com/SuperKnux/HexMod/raw/refs/heads/indev/1.21.1/libs/paucal-0.7.1-noelle+1.21.1-fabric.jar'
65+
'https://ci.blamejared.com/job/petrakat/job/PAUCAL/job/1.21/27/artifact/Fabric/build/libs/paucal-0.7.1-pre-27+1.21.1-fabric.jar'
6666
'https://cdn.modrinth.com/data/fin1PX4m/versions/SBDJBD0a/inline-fabric-1.21.1-1.2.2.jar'
6767
'https://cdn.modrinth.com/data/K01OU20C/versions/nLsCe2VD/cardinal-components-api-6.1.3.jar'
6868
'https://cdn.modrinth.com/data/nU0bVIaL/versions/XIjNwQkI/Patchouli-1.21.1-93-FABRIC.jar'
6969
'https://cdn.modrinth.com/data/mOgUt4GM/versions/v6Xx3fbU/modmenu-11.0.4.jar'
7070
'https://cdn.modrinth.com/data/5aaWibi9/versions/JagCscwi/trinkets-3.10.0.jar'
71+
'https://cdn.modrinth.com/data/lhGA9TYQ/versions/Pzc2FP5K/architectury-13.0.11-fabric.jar'
7172
- modloader: neoforge
7273
mc-runtime-test: neoforge
7374
fabric-api: none
@@ -88,17 +89,18 @@ jobs:
8889
java-version: ${{ env.JAVA_VERSION }}
8990

9091
- name: Create cache key
92+
id: cache-key
9193
run: |
9294
cat <<END_OF_FILE > dependencies.txt
9395
${{ matrix.dependencies }}
9496
END_OF_FILE
95-
96-
- name: Cache dependencies
97+
echo "key=$(sha256sum dependencies.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
98+
- name: Restore cached dependencies
9799
id: cache
98-
uses: actions/cache@v4
100+
uses: actions/cache/restore@v4
99101
with:
100102
path: run/mods
101-
key: ${{ hashFiles('dependencies.txt') }}
103+
key: ${{ steps.cache-key.outputs.key }}
102104

103105
- name: Download dependencies
104106
if: steps.cache.outputs.cache-hit != 'true'
@@ -107,6 +109,14 @@ jobs:
107109
wget --directory-prefix=run/mods/ "$url"
108110
done
109111
112+
# Cache has to be saved here already to avoid also caching the build artifact at the end of the run
113+
- name: Cache dependencies
114+
uses: actions/cache/save@v4
115+
if: steps.cache.outputs.cache-hit != 'true'
116+
with:
117+
path: run/mods
118+
key: ${{ steps.cache-key.outputs.key }}
119+
110120
- name: Download build artifacts
111121
uses: actions/download-artifact@v4
112122
with:
@@ -115,13 +125,13 @@ jobs:
115125

116126
- name: Prepare mod jar
117127
run: |
118-
rm -f dist/*-javadoc.jar dist/*-sources.jar
128+
rm -f dist/*-javadoc.jar dist/*-sources.jar dist/*-shadow.jar
119129
cp dist/hexcasting-${{ matrix.modloader }}-*.jar run/mods
120130
121131
- name: Run MC test client
122132
if: matrix.env == 'client'
123133
timeout-minutes: 10
124-
uses: headlesshq/mc-runtime-test@4.4.0
134+
uses: headlesshq/mc-runtime-test@4.5.1
125135
with:
126136
java: ${{ env.JAVA_VERSION }}
127137
mc: 1.21.1
@@ -135,7 +145,7 @@ jobs:
135145
timeout-minutes: 10
136146
uses: headlesshq/mc-server-test@1.1.1
137147
with:
138-
java: 21
148+
java: ${{ env.JAVA_VERSION }}
139149
mc: 1.21.1
140150
modloader: ${{ matrix.modloader }}
141151
fabric-api: ${{ matrix.fabric-api }}

0 commit comments

Comments
 (0)