Skip to content

Commit

Permalink
new server runtime tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifiht committed Oct 19, 2024
1 parent ab29a1a commit e7eaf65
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
- name: Build with Gradle Wrapper
run: ./gradlew build

- name: Build with Gradle Wrapper
run: ./gradlew cleanPaperPluginsCache

- name: Build with Gradle Wrapper
run: ./gradlew runServer

- name: Check the Server Logs
run: ./gradlew checkServerLogs

# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
Expand Down
31 changes: 31 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,39 @@ runServer {
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.21.1")
downloadPlugins {
github("Ifiht", "AutoStop", "v1.1.0", "AutoStop-1.1.0.jar")
}
}

runPaper.folia.registerTask() {
minecraftVersion("1.20.6")
}

tasks.register("checkServerLogs") {
doLast {
// Path to the latest.log file
File logFile = file("run/logs/latest.log")

// Check if the log file exists
if (!logFile.exists()) {
throw new GradleException("Log file not found: " + logFile.getAbsolutePath())
}

// Read the log file line by line
def logContent = logFile.readLines()

// Find lines that contain the " ERROR]:" substring
def errorLines = logContent.findAll { it.contains("ERROR]:") }

if (!errorLines.isEmpty()) {
println "Errors were found:"
errorLines.each { line ->
println line // Print the full line that contains " ERROR]"
}
throw new GradleException("Errors found in log file.")
} else {
println "No errors found in log file."
}
}
}

0 comments on commit e7eaf65

Please sign in to comment.