-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure project, add integration tests, gradle for github issues (#…
…32) * chore: remove old typescript launch options * chore: update gradle to 8.12, use source/javadoc version * refactor(gradle): Create version catalog for dependencies * refactor(gradle): Create convention plugin * build: create plugin for remote integration test (testing in prod) * build: create plugin for creating/closing github issues based on test results * refactor: Split project to modules, seperate by 'internal' keyword, add HTLBProxyServer class for testing * build: Add caching and parallel execution, disable conf cache Configuration cache is disabled because Gradle returns errors when you execute github issue plugins * refactor(IDE): Change "run server" to server module and port to 13370 * build(docker): Update gradle version, jdk to 23, use new path to jar * fix(parsing): When value cannot be parsed, return null instead of 0 * cleanup(gradle): Remove useless parentheses
- Loading branch information
Showing
60 changed files
with
950 additions
and
162 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
.run/Run 256M app at _1337.run.xml → .run/Run 256M app at _13370.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
FROM gradle:8.10.1-jdk21 AS build | ||
FROM gradle:8.12.0-jdk23 AS build | ||
COPY --chown=gradle:gradle . /home/gradle/src | ||
WORKDIR /home/gradle/src | ||
RUN gradle shadowJar --no-daemon | ||
RUN gradle :server:shadowJar --no-daemon | ||
|
||
FROM eclipse-temurin:21-jre-alpine | ||
FROM eclipse-temurin:23-jre-alpine | ||
|
||
COPY --from=build /home/gradle/src/build/libs/ /app/ | ||
ENTRYPOINT ["java","-jar","/app/HowLongToBeat-Proxy-API-1.0-SNAPSHOT-all.jar"] | ||
COPY --from=build /home/gradle/src/server/build/libs/ /app/ | ||
ENTRYPOINT ["java","-jar","/app/server-all.jar"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
plugins { | ||
// The Kotlin DSL plugin provides a convenient way to develop convention plugins. | ||
// Convention plugins are located in `src/main/kotlin`, with the file extension `.gradle.kts`, | ||
// and are applied in the project's `build.gradle.kts.backup` files as required. | ||
`kotlin-dsl` | ||
alias(libs.plugins.kotlinSerialization) | ||
idea | ||
} | ||
|
||
|
||
idea { | ||
module { | ||
isDownloadJavadoc = true | ||
isDownloadSources = true | ||
} | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(23) | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(23) | ||
} | ||
} | ||
|
||
dependencies { | ||
// Add a dependency on the Kotlin Gradle plugin, so that convention plugins can apply it. | ||
implementation(libs.kotlinGradlePlugin) | ||
implementation(libs.bundles.kotlinxXml) | ||
implementation(libs.githubApi) | ||
testImplementation(kotlin("test")) | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
dependencyResolutionManagement { | ||
|
||
// Use Maven Central and the Gradle Plugin Portal for resolving dependencies in the shared build logic (`buildSrc`) project. | ||
@Suppress("UnstableApiUsage") | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
// Reuse the version catalog from the main build. | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import junitParse.TestCase | ||
import junitParse.TestSuite | ||
|
||
object MarkdownConverter { | ||
fun convert(tests: List<TestSuite>): Sequence<String> { | ||
require(tests.isNotEmpty()) { "There's no tests to convert to markdown" } | ||
return sequence { | ||
for ((index, test) in tests.withIndex()) { | ||
if (index != 0) { | ||
yield("-----------") | ||
} | ||
yield(test.toMarkdown()) | ||
} | ||
} | ||
} | ||
|
||
private fun markdownDetails(summary: String, content: () -> String): String { | ||
return """ | ||
|<details> | ||
|<summary>$summary</summary> | ||
| | ||
|${content()} | ||
| | ||
|</details> | ||
""".trimMargin("|") | ||
} | ||
|
||
private fun TestSuite.toMarkdown(): String { | ||
val markdownCases = cases.joinToString(separator = "\n") { it.toMarkdown() } | ||
val markdownStdout = markdownDetails("STDOUT") { | ||
""" | ||
|```java | ||
|${systemOut.data} | ||
|``` | ||
""".trimMargin("|") | ||
} | ||
val markdownStderr = markdownDetails("STDERR") { | ||
""" | ||
|```java | ||
|${systemErr.data} | ||
|``` | ||
""".trimMargin("|") | ||
} | ||
|
||
|
||
return """ | ||
|# ${this.name} | ||
|- Tests: ${this.tests} | ||
|- Skipped: ${this.skipped} | ||
|- Failures: ${this.failures} | ||
|- Errors: ${this.failures} | ||
|- Timestamp: ${this.timestamp} | ||
|- Execution time: ${this.time} | ||
| | ||
|## Cases | ||
|$markdownCases | ||
| | ||
|## Outputs | ||
|$markdownStdout | ||
| | ||
|$markdownStderr | ||
""".trimMargin("|") | ||
} | ||
|
||
|
||
private fun TestCase.toMarkdown(): String { | ||
val emojiStatus = if (this.failure == null) "✅" else "❌" | ||
val failureDetails = failure?.run { | ||
""" | ||
|- Error type: `$type` | ||
|- Message: | ||
|```java | ||
|$message | ||
|``` | ||
| | ||
""".trimMargin("|") | ||
} | ||
return markdownDetails("$name $emojiStatus") { | ||
""" | ||
|- Classname: $classname | ||
|- Execution time: $time | ||
|${failureDetails ?: ""} | ||
""".trimMargin("|") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
plugins { | ||
kotlin("jvm") | ||
idea | ||
} | ||
|
||
group = "io.github.darefox" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(23) | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(23) | ||
} | ||
} | ||
|
||
idea { | ||
module { | ||
isDownloadJavadoc = true | ||
isDownloadSources = true | ||
} | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import java.net.URL | ||
|
||
interface RemoteTest { | ||
val enabled: Property<Boolean> | ||
val url: Property<URL> | ||
} | ||
|
||
val remoteTestExt = extensions.create<RemoteTest>("remoteTest") | ||
remoteTestExt.enabled = false | ||
|
||
afterEvaluate { | ||
val tests = tasks.withType<Test>() | ||
for (test in tests) { | ||
val location = test.reports.junitXml.outputLocation | ||
tasks.register<Delete>("${test.name}-cleanResults") { | ||
setDelete(location) | ||
} | ||
} | ||
} | ||
|
||
tasks.register("remoteSystemTest") { | ||
remoteTestExt.enabled = true | ||
dependsOn("systemTest") | ||
} |
Oops, something went wrong.