add CI-CD
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 1m46s

This commit is contained in:
zhangyuheng 2024-03-24 01:34:33 +08:00
parent 1748ac6da1
commit 3a20286a24
3 changed files with 259 additions and 19 deletions

View File

@ -0,0 +1,39 @@
name: Java CI-CD with Gradle
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Pull & Checkout"
uses: https://ssl.lunadeer.cn:14446/actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up JDK 17"
uses: https://ssl.lunadeer.cn:14446/actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: 'gradle'
- name: "Apply Patches"
run: ./gradlew applyPatches
- name: "Build Mojmap"
run: ./gradlew createMojmapPaperclipJar
- name: "Copy jar to staging"
run: mkdir staging && cp build/libs/*.jar staging
- name: "Setup go for release script"
run: |
wget --no-check-certificate https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/bin/go
go version
- name: "Release"
uses: https://ssl.lunadeer.cn:14446/actions/release-action@main
with:
files: |-
staging/*.jar
api_key: '${{secrets.RELEASE_TOKEN}}'

View File

@ -0,0 +1,220 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: zhangyuheng <zhangyuheng@lunadeer.cn>
Date: Mon, 26 Feb 2024 18:00:41 +0800
Subject: [PATCH] Rebranding
diff --git a/build.gradle.kts b/build.gradle.kts
index 08d434023226af0d2c469055a3b2188fe8a4ed38..b09877db43215896d4c775f76605880f2d6bd0f9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating
dependencies {
// Folia start
- implementation(project(":folia-api"))
+ implementation(project(":deer-folia-api"))
implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
exclude("io.papermc.paper", "paper-api")
}
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..bad1284f624a25ec9aeb0c5ce67c4ec6fecdd031 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Folia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page
+ Metrics metrics = new Metrics("DeerFolia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -612,6 +612,10 @@ public class Metrics {
paperVersion = "unknown";
}
metrics.addCustomChart(new Metrics.SimplePie("folia_version", () -> paperVersion)); // Folia - we have our own bstats page
+ metrics.addCustomChart(new Metrics.SimplePie("deer_folia_version", ()
+ -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null)
+ ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion()
+ : "unknown")); // DeerFolia
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index e2f704c115fd6e00960bb56bb0779f1100c89c17..a54a0fadb45c6b506c93c51e96fb5502a0e2b6cb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -20,7 +20,11 @@ import java.util.stream.StreamSupport;
public class PaperVersionFetcher implements VersionFetcher {
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
private static final String GITHUB_BRANCH_NAME = "master";
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
+
+ // DeerFolia start
+ private static final String DOWNLOAD_PAGE = "https://ssl.lunadeer.cn:14446/zhangyuheng/DeerFolia/releases";
+ // DeerFolia end
+
private static @Nullable String mcVer;
@Override
@@ -31,8 +35,11 @@ public class PaperVersionFetcher implements VersionFetcher {
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
+ String[] parts = serverVersion.substring("git-DeerFolia-".length()).split("[-\\s]"); // Folia // DeerFolia
+ // DeerFolia start - Disable update check
+ // final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
+ final Component updateMessage = Component.text("DeerFolia current does not support update check", NamedTextColor.YELLOW); // DeerFolia
+ // DeerFolia end - Disable update check
final Component history = getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -45,7 +52,7 @@ public class PaperVersionFetcher implements VersionFetcher {
String result = matcher.group();
mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
} else {
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to DeerFolia!");
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
}
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..d5c8b196c1282eecd74ce046242700b57cfde140 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Paper")
+ .appName("DeerFolia") // DeerFolia
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 99c5038672b09d0874125e3df280174c1e8151e6..f44fbef4372b3c6ba3e1e6f81de469b2f764558d 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -127,7 +127,7 @@ public class CrashReport {
stringbuilder.append("---- Minecraft Crash Report ----\n");
stringbuilder.append("// ");
stringbuilder.append(CrashReport.getErrorComment());
- stringbuilder.append("\n\n");
+ stringbuilder.append("// DO NOT REPORT THIS TO PAPER/FOLIA! REPORT TO DEERFOLIA INSTEAD!"); // DeerFolia
stringbuilder.append("Time: ");
stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
stringbuilder.append("\n");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3ec07e77748ee9bb21f9d09230f935bca2217e4d..ef7f77b4643a83ae241f8bb91e2b41bbd4fa6470 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1025,7 +1025,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (false && !isSameThread()) { // Folia - region threading
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO DEERFOLIA)"); // DeerFolia
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 853afba9d0a814acc001ba5db5ef3653f8b16392..15ecf9e10cce687536b7aa134390263cd90e5a53 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Folia"; // Folia // Paper
+ private final String serverName = "DeerFolia"; // DeerFolia // Folia // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 6abb7ee0f5d32613b2ff7da09810ae407e293838..bcf0813afaa4fcbd66a39f1db14317e53de11f97 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -961,7 +961,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return EntityCategory.WATER;
}
- throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Spigot.");
+ throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to DeerFolia."); // DeerFolia
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index b00e3b9b628f3d2a2fdbf1d2c77904963c16d3ac..989ade9becdf3076d2e2a861e76a375078f42485 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -503,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to DeerFolia"); // Paper // DeerFolia
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index e9b6ca3aa25e140467ae866d572483050ea3fa0e..4b84eb8ceb719bb6b4dc281b32c5b67b45e78159 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.folia/folia-api/pom.properties"); // Folia
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/cn.lunadeer/deer-folia-api/pom.properties"); // Folia // DeerFolia
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 9e638f72f180ff5ef63ec3dd6cf548c53f7bd4a5..ae48367c8a1430485272d4e8333f091aeb8f1e19 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a DeerFolia bug." ); // Paper // DeerFolia
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a DeerFolia bug, please report this to zhangyuheng@lunadeer.cn" ); // DeerFolia
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "DeerFolia version: " + Bukkit.getServer().getVersion() ); // DeerFolia
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -184,12 +184,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO DeerFolia - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // DeerFolia
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to DeerFolia!):" ); // Paper // DeerFolia
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -205,7 +205,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO DEERFOLIA - THIS IS NOT A BUG OR A CRASH ---"); // DeerFolia
}
log.log( Level.SEVERE, "------------------------------" );

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: zhangyuheng <zhangyuheng@lunadeer.cn>
Date: Mon, 26 Feb 2024 18:00:41 +0800
Subject: [PATCH] Update gradle script to custom
diff --git a/build.gradle.kts b/build.gradle.kts
index 08d434023226af0d2c469055a3b2188fe8a4ed38..b09877db43215896d4c775f76605880f2d6bd0f9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating
dependencies {
// Folia start
- implementation(project(":folia-api"))
+ implementation(project(":deer-folia-api"))
implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
exclude("io.papermc.paper", "paper-api")
}