Skip to content

Commit 6ccb05e

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8530edc + 6ed3ee8 commit 6ccb05e

39 files changed

+1303
-1151
lines changed

.github/workflows/gradle.yml

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -87,57 +87,34 @@ jobs:
8787
done
8888
echo "</details>" >> $GITHUB_STEP_SUMMARY
8989
90-
- name: Run the mod and take screenshots
91-
# TODO: Migrate to Fabric Client Gametest API so this can run with configuration cache enabled
92-
run: xvfb-run --auto-servernum ./gradlew runEndToEndTest --stacktrace --warning-mode=fail --no-configuration-cache
90+
- name: Run client gametests
91+
env:
92+
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
93+
run: xvfb-run --auto-servernum ./gradlew runClientGameTest --stacktrace --warning-mode=fail
94+
95+
- name: Run client gametests with mods
96+
env:
97+
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
98+
run: xvfb-run --auto-servernum ./gradlew runClientGameTestWithMods --stacktrace --warning-mode=fail
9399

94-
- name: Upload screenshots.zip artifact
100+
- name: Upload screenshots
95101
uses: actions/upload-artifact@v5
96102
if: ${{ success() || failure() }}
97103
with:
98104
name: screenshots
99-
path: run/screenshots
105+
path: build/run/*/screenshots
100106
compression-level: 0
101107

102-
- name: Upload crash-reports.zip artifact
108+
- name: Upload logs
109+
uses: actions/upload-artifact@v5
110+
if: ${{ success() || failure() }}
111+
with:
112+
name: logs
113+
path: build/run/*/logs/latest.log
114+
115+
- name: Upload crash reports
103116
uses: actions/upload-artifact@v5
104117
if: ${{ failure() }}
105118
with:
106119
name: crash-reports
107-
path: run/crash-reports
108-
109-
- name: Create test screenshot gallery
110-
env:
111-
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
112-
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }}
113-
# Imgur uploads randomly fail sometimes, probably because of the low rate limit.
114-
# TODO: Find a better place to upload the screenshots.
115-
continue-on-error: true
116-
run: |
117-
echo "<details open>" >> $GITHUB_STEP_SUMMARY
118-
echo "<summary>📸 Test Screenshots</summary>" >> $GITHUB_STEP_SUMMARY
119-
echo "" >> $GITHUB_STEP_SUMMARY
120-
for img in run/screenshots/*.png; do
121-
if [ -f "$img" ]; then
122-
filename=$(basename "$img")
123-
name_without_ext="${filename%.*}"
124-
# Upload to Imgur
125-
response=$(curl -s -X POST \
126-
-H "Authorization: Client-ID $IMGUR_CLIENT_ID" \
127-
-F "image=@$img" \
128-
https://api.imgur.com/3/image)
129-
# Extract the URL from the response
130-
url=$(echo $response | grep -o '"link":"[^"]*"' | cut -d'"' -f4)
131-
if [ ! -z "$url" ]; then
132-
# Convert underscores to spaces and capitalize first letter of each word
133-
title=$(echo "$name_without_ext" | tr '_' ' ' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
134-
echo "### $title" >> $GITHUB_STEP_SUMMARY
135-
echo "![${name_without_ext}]($url)" >> $GITHUB_STEP_SUMMARY
136-
echo "" >> $GITHUB_STEP_SUMMARY
137-
else
138-
echo "Failed to upload $filename" >> $GITHUB_STEP_SUMMARY
139-
echo "Imgur upload response for $filename: $response"
140-
fi
141-
fi
142-
done
143-
echo "</details>" >> $GITHUB_STEP_SUMMARY
120+
path: build/run/*/crash-reports

build.gradle

Lines changed: 48 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ buildscript {
22
dependencies {
33
classpath "org.kohsuke:github-api:1.330"
44
}
5-
6-
configurations.classpath {
7-
resolutionStrategy {
8-
// v28.0-jre, used by fabric-loom 1.13.3, is vulnerable to CVE-2020-8908 and CVE-2023-2976
9-
force "com.google.guava:guava:32.0.1-jre"
10-
}
11-
}
125
}
136

147
plugins {
@@ -51,23 +44,16 @@ repositories {
5144
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
5245
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
5346
// for more information about repositories.
54-
}
55-
56-
// Override vulnerable dependencies until Minecraft updates to newer versions
57-
configurations.all {
58-
resolutionStrategy {
59-
// v2.5.1, used by Minecraft 1.21.4 - 1.21.10, is vulnerable to CVE-2024-57699
60-
force "net.minidev:json-smart:2.5.2"
61-
// v2.13.4, used by Minecraft 1.21.4 - 1.21.10, is vulnerable to CVE-2025-52999
62-
force "com.fasterxml.jackson.core:jackson-core:2.15.0"
63-
// v3.17.0, used by Minecraft 1.21.4 - 1.21.10, is vulnerable to CVE-2025-48924
64-
force "org.apache.commons:commons-lang3:3.18.0"
65-
// v9.40, used by Minecraft 1.21.4 - 1.21.10, is vulnerable to CVE-2025-53864
66-
force "com.nimbusds:nimbus-jose-jwt:10.0.2"
67-
// v4.1.118.Final, used by Minecraft 1.21.5 - 1.21.10, is vulnerable to CVE-2025-58057
68-
force "io.netty:netty-codec:4.1.125.Final"
69-
// v4.1.118.Final, used by Minecraft 1.21.5 - 1.21.10, is vulnerable to CVE-2025-58056
70-
force "io.netty:netty-codec-http:4.1.125.Final"
47+
exclusiveContent {
48+
forRepository {
49+
maven {
50+
name = "Modrinth"
51+
url = "https://api.modrinth.com/maven"
52+
}
53+
}
54+
filter {
55+
includeGroup "maven.modrinth"
56+
}
7157
}
7258
}
7359

@@ -90,54 +76,53 @@ dependencies {
9076
modImplementation "com.google.code.findbugs:jsr305:3.0.2"
9177
}
9278

79+
fabricApi.configureTests {
80+
createSourceSet = true
81+
enableGameTests = false
82+
enableClientGameTests = true
83+
modId = "wurst_testmod"
84+
username = "Wurst-Bot"
85+
}
86+
9387
loom {
9488
accessWidenerPath = file("src/main/resources/wurst.accesswidener")
89+
90+
runs {
91+
clientGameTestWithMods {
92+
inherit client
93+
source = sourceSets.gametest
94+
runDir = "build/run/clientGameTestWithMods"
95+
vmArgs.add("-Dfabric.client.gametest")
96+
vmArgs.add("-Dwurst.test.withMods=true")
97+
programArgs.add("--username=Wurst-Bot")
98+
}
99+
}
95100
}
96101

97102
configurations {
98-
productionRuntime {
99-
extendsFrom configurations.minecraftLibraries
100-
extendsFrom configurations.loaderLibraries
101-
extendsFrom configurations.minecraftRuntimeLibraries
103+
testMods {
104+
transitive = false
102105
}
103106
}
104107

105108
dependencies {
106-
productionRuntime "net.fabricmc:fabric-loader:${project.loader_version}"
107-
productionRuntime "net.fabricmc:intermediary:${project.minecraft_version}"
109+
testMods "maven.modrinth:sodium:${project.sodium_version}"
108110
}
109111

110-
import net.fabricmc.loom.util.Platform
111-
import java.util.Locale
112-
tasks.register('runEndToEndTest', JavaExec) {
113-
dependsOn remapJar, downloadAssets
114-
classpath.from configurations.productionRuntime
115-
mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient"
116-
workingDir = file("run")
117-
118-
doFirst {
119-
classpath.from loom.minecraftProvider.minecraftClientJar
120-
workingDir.mkdirs()
121-
122-
args(
123-
"--assetIndex", loom.minecraftProvider.versionInfo.assetIndex().fabricId(loom.minecraftProvider.minecraftVersion()),
124-
"--assetsDir", new File(loom.files.userCache, "assets").absolutePath,
125-
"--gameDir", workingDir.absolutePath
126-
)
127-
128-
if (Platform.CURRENT.operatingSystem.isMacOS()) {
129-
jvmArgs("-XstartOnFirstThread")
130-
}
131-
132-
jvmArgs(
133-
"-Dfabric.addMods=${configurations.modImplementation.find { it.name.contains('fabric-api') }.absolutePath}${File.pathSeparator}${remapJar.archiveFile.get().asFile.absolutePath}",
134-
"-Dwurst.e2eTest",
135-
"-Dfabric-tag-conventions-v2.missingTagTranslationWarning=fail",
136-
"-Dfabric-tag-conventions-v1.legacyTagWarning=fail",
137-
"-Dmixin.debug.verify=true",
138-
"-Dmixin.debug.countInjections=true"
139-
)
140-
}
112+
def cleanClientGameTestWithMods = tasks.register("cleanClientGameTestWithMods", Delete) {
113+
delete layout.buildDirectory.dir("run/clientGameTestWithMods")
114+
}
115+
116+
def prepareClientGameTestWithMods = tasks.register("prepareClientGameTestWithMods", Sync) {
117+
dependsOn cleanClientGameTestWithMods
118+
from configurations.testMods
119+
into layout.buildDirectory.dir("run/clientGameTestWithMods/mods")
120+
}
121+
122+
def doModCompatTest = providers.gradleProperty("do_mod_compat_test").map { it.toBoolean() }.orElse(false)
123+
tasks.named("runClientGameTestWithMods") {
124+
onlyIf { doModCompatTest.get() }
125+
dependsOn prepareClientGameTestWithMods
141126
}
142127

143128
processResources {
@@ -236,13 +221,13 @@ spotless {
236221
eclipse().configFile(file("codestyle/formatter.xml"))
237222
}
238223
format("licenseHeader") {
239-
target("src/*/java/**/*.java", "src/test/java/**/*.java")
224+
target("src/*/java/**/*.java")
240225
def header_file = file("codestyle/license_header.txt")
241226
def delimiter = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER
242227
licenseHeaderFile(header_file, delimiter).updateYearWithLatest(true)
243228
}
244229
json {
245-
target "src/**/*.json"
230+
target("src/**/*.json", "src/**/*.mcmeta")
246231
gson().indentWithSpaces(2).version("2.11.0")
247232
}
248233
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ loader_version=0.17.3
1212
loom_version=1.13-SNAPSHOT
1313

1414
# Fabric API
15-
fabric_version=0.138.0+1.21.10
15+
fabric_version=0.138.3+1.21.10
1616

1717
# Mod Properties
1818
mod_version=v7.51-CevAPI-MC1.21.10
@@ -25,3 +25,5 @@ gh_repo_id=cev-api/Wurst7-CevAPI
2525
mcx_repo_id=Wurst-Imperium/Wurst-MCX2
2626

2727
# Dependencies
28+
sodium_version=mc1.21.10-0.7.2-fabric
29+
do_mod_compat_test=true

0 commit comments

Comments
 (0)