diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71d7ad9a..3d338a95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,6 +108,16 @@ jobs: # parallel: 3 parallel: 1 + - name: Create coverage report with Tarpaulin + run: | + cargo install cargo-tarpaulin + cargo tarpaulin --out xml --output-dir coverage/rust --workspace + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + lint: runs-on: ubuntu-latest diff --git a/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.main.iml b/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.main.iml index a53f25a5..40b7c635 100644 --- a/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.main.iml +++ b/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -57,7 +57,7 @@ - + diff --git a/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.test.iml b/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.test.iml index 3bd0fa4c..1ec4f692 100644 --- a/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.test.iml +++ b/.idea/modules/packages/google-agones-sdk/bindings/java/shulker.packages.google-agones-sdk-bindings-java.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.bungeecord.iml b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.bungeecord.iml index da9f6113..4051ccca 100644 --- a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.bungeecord.iml +++ b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.bungeecord.iml @@ -19,7 +19,7 @@ - + @@ -43,13 +43,16 @@ - + - - + + - - + + + + + @@ -63,7 +66,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.common.iml b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.common.iml index bcefdd01..f4529847 100644 --- a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.common.iml +++ b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.common.iml @@ -18,7 +18,7 @@ - + @@ -42,13 +42,16 @@ - + - - + + - - + + + + + @@ -59,7 +62,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.main.iml b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.main.iml index e0aebf5e..cc7c6129 100644 --- a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.main.iml +++ b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.main.iml @@ -20,7 +20,7 @@ - + @@ -44,13 +44,16 @@ - + - - + + - - + + + + + @@ -58,7 +61,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.test.iml b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.test.iml index 7f791955..63d4d443 100644 --- a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.test.iml +++ b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,16 @@ - + - - + + - - + + + + + @@ -51,7 +54,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.velocity.iml b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.velocity.iml index e343dd1e..2d3b741d 100644 --- a/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.velocity.iml +++ b/.idea/modules/packages/shulker-proxy-agent/shulker.packages.shulker-proxy-agent.velocity.iml @@ -19,7 +19,7 @@ - + @@ -43,13 +43,16 @@ - + - - + + - - + + + + + @@ -65,7 +68,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.main.iml b/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.main.iml index 896b051b..5bd31ca4 100644 --- a/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.main.iml +++ b/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -54,7 +54,7 @@ - + diff --git a/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.test.iml b/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.test.iml index 21ca7e1a..97fffa4f 100644 --- a/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.test.iml +++ b/.idea/modules/packages/shulker-proxy-api/shulker.packages.shulker-proxy-api.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.main.iml b/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.main.iml index b7e3d09e..15d3138b 100644 --- a/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.main.iml +++ b/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -57,7 +57,7 @@ - + diff --git a/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.test.iml b/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.test.iml index 4c057272..33834d30 100644 --- a/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.test.iml +++ b/.idea/modules/packages/shulker-sdk/bindings/java/shulker.packages.shulker-sdk-bindings-java.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.common.iml b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.common.iml index 4e896186..ef47a0e8 100644 --- a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.common.iml +++ b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.common.iml @@ -18,7 +18,7 @@ - + @@ -42,13 +42,13 @@ - + - - + + - - + + @@ -59,7 +59,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.main.iml b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.main.iml index 06b0bc22..48a7c3b3 100644 --- a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.main.iml +++ b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.paper.iml b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.paper.iml index 9f45aa94..ab63695d 100644 --- a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.paper.iml +++ b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.paper.iml @@ -19,7 +19,7 @@ - + @@ -43,13 +43,13 @@ - + - - + + - - + + @@ -61,7 +61,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.test.iml b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.test.iml index f661be5b..ae63b561 100644 --- a/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.test.iml +++ b/.idea/modules/packages/shulker-server-agent/shulker.packages.shulker-server-agent.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.main.iml b/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.main.iml index 6313ecbe..381eb751 100644 --- a/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.main.iml +++ b/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -54,7 +54,7 @@ - + diff --git a/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.test.iml b/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.test.iml index 8a78bd8b..eb891966 100644 --- a/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.test.iml +++ b/.idea/modules/packages/shulker-server-api/shulker.packages.shulker-server-api.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker.packages.main.iml b/.idea/modules/packages/shulker.packages.main.iml index 6cea9877..c3643e64 100644 --- a/.idea/modules/packages/shulker.packages.main.iml +++ b/.idea/modules/packages/shulker.packages.main.iml @@ -13,7 +13,7 @@ - + @@ -37,13 +37,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.idea/modules/packages/shulker.packages.test.iml b/.idea/modules/packages/shulker.packages.test.iml index 38893905..96889c7a 100644 --- a/.idea/modules/packages/shulker.packages.test.iml +++ b/.idea/modules/packages/shulker.packages.test.iml @@ -12,7 +12,7 @@ - + @@ -36,13 +36,13 @@ - + - - + + - - + + @@ -51,7 +51,7 @@ - + diff --git a/.releaserc.cjs b/.releaserc.cjs index f47fce5b..cd9ca545 100644 --- a/.releaserc.cjs +++ b/.releaserc.cjs @@ -1,71 +1,11 @@ const fileReplacements = [ { - files: ['packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs'], - from: 'const PROXY_SHULKER_PROXY_AGENT_VERSION: &str = ".*";', - to: 'const PROXY_SHULKER_PROXY_AGENT_VERSION: &str = "${nextRelease.version}";', - results: [ - { - file: 'packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs', - hasChanged: true, - numMatches: 1, - numReplacements: 1, - }, - ], - countMatches: true, - }, - { - files: [ - 'packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs', - ], - from: 'const MINECRAFT_SERVER_SHULKER_PROXY_AGENT_VERSION: &str = ".*";', - to: 'const MINECRAFT_SERVER_SHULKER_PROXY_AGENT_VERSION: &str = "${nextRelease.version}";', - results: [ - { - file: 'packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs', - hasChanged: true, - numMatches: 1, - numReplacements: 1, - }, - ], - countMatches: true, - }, - { - files: ['packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml'], - from: 'version: .*', - to: 'version: ${nextRelease.version}', - results: [ - { - file: 'packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml', - hasChanged: true, - numMatches: 1, - numReplacements: 1, - }, - ], - countMatches: true, - }, - { - files: [ - 'packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt', - ], - from: 'version = ".*"', + files: ['Cargo.toml'], + from: '^version = ".*"$', to: 'version = "${nextRelease.version}"', results: [ { - file: 'packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt', - hasChanged: true, - numMatches: 1, - numReplacements: 1, - }, - ], - countMatches: true, - }, - { - files: ['packages/shulker-server-agent/src/paper/resources/plugin.yml'], - from: 'version: .*', - to: 'version: ${nextRelease.version}', - results: [ - { - file: 'packages/shulker-server-agent/src/paper/resources/plugin.yml', + file: 'Cargo.toml', hasChanged: true, numMatches: 1, numReplacements: 1, diff --git a/Cargo.lock b/Cargo.lock index 60d2dbfd..65859151 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -781,7 +781,7 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "google-agones-crds" -version = "0.0.0" +version = "0.1.0" dependencies = [ "k8s-openapi", "kube", @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "shulker-crds" -version = "0.0.0" +version = "0.1.0" dependencies = [ "base64 0.21.4", "google-agones-crds", @@ -1870,7 +1870,7 @@ dependencies = [ [[package]] name = "shulker-operator" -version = "0.0.0" +version = "0.1.0" dependencies = [ "actix-web", "anyhow", @@ -1903,7 +1903,7 @@ dependencies = [ [[package]] name = "shulker-sdk" -version = "0.0.0" +version = "0.1.0" dependencies = [ "prost", "tonic", @@ -1911,7 +1911,7 @@ dependencies = [ [[package]] name = "shulker-utils" -version = "0.0.0" +version = "0.1.0" dependencies = [ "chrono", ] diff --git a/Cargo.toml b/Cargo.toml index 7c4be409..91d0e7ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ ] [workspace.package] -version = "0.0.0" +version = "0.1.0" authors = ["Jérémy Levilain "] edition = "2021" publish = false diff --git a/build.gradle.kts b/build.gradle.kts index 85bf6efb..ee89a3c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ plugins { idea java `java-library` + jacoco `maven-publish` signing kotlin("jvm") version "1.9.0" @@ -28,6 +29,7 @@ subprojects { apply(plugin = "idea") apply(plugin = "java") apply(plugin = "java-library") + apply(plugin = "jacoco") apply(plugin = "maven-publish") apply(plugin = "signing") apply(plugin = "org.jetbrains.kotlin.jvm") @@ -60,6 +62,17 @@ subprojects { shadowJar { archiveClassifier.set("") } + + jacocoTestReport { + reports { + csv.required = false + html.required = false + } + } + + test { + finalizedBy("jacocoTestReport") + } } publishing { diff --git a/packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs b/packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs index d56b2542..d1578a86 100644 --- a/packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs +++ b/packages/shulker-operator/src/reconcilers/minecraft_server/gameserver.rs @@ -34,7 +34,7 @@ use super::MinecraftServerReconciler; const MINECRAFT_SERVER_SHULKER_CONFIG_DIR: &str = "/mnt/shulker/config"; const MINECRAFT_SERVER_CONFIG_DIR: &str = "/config"; const MINECRAFT_SERVER_DATA_DIR: &str = "/data"; -const MINECRAFT_SERVER_SHULKER_PROXY_AGENT_VERSION: &str = "0.1.0"; +const MINECRAFT_SERVER_SHULKER_PROXY_AGENT_VERSION: &str = env!("CARGO_PKG_VERSION"); const MINECRAFT_SERVER_SHULKER_MAVEN_REPOSITORY: &str = "https://maven.jeremylvln.fr/artifactory/shulker"; diff --git a/packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs b/packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs index 2b307f68..c69fadd5 100644 --- a/packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs +++ b/packages/shulker-operator/src/reconcilers/proxy_fleet/fleet.rs @@ -42,7 +42,7 @@ const PROXY_SHULKER_CONFIG_DIR: &str = "/mnt/shulker/config"; const PROXY_SHULKER_FORWARDING_SECRET_DIR: &str = "/mnt/shulker/forwarding-secret"; const PROXY_DATA_DIR: &str = "/server"; const PROXY_DRAIN_LOCK_DIR: &str = "/mnt/drain-lock"; -const PROXY_SHULKER_PROXY_AGENT_VERSION: &str = "0.1.0"; +const PROXY_SHULKER_PROXY_AGENT_VERSION: &str = env!("CARGO_PKG_VERSION"); const PROXY_SHULKER_MAVEN_REPOSITORY: &str = "https://maven.jeremylvln.fr/artifactory/shulker"; lazy_static! { diff --git a/packages/shulker-proxy-agent/build.gradle.kts b/packages/shulker-proxy-agent/build.gradle.kts index 8a4687c8..9b5558ec 100644 --- a/packages/shulker-proxy-agent/build.gradle.kts +++ b/packages/shulker-proxy-agent/build.gradle.kts @@ -1,3 +1,7 @@ +plugins { + id("com.github.gmazzo.buildconfig") version "4.1.2" +} + dependencies { commonApi(project(":packages:shulker-proxy-api")) @@ -21,4 +25,25 @@ tasks { dependsOn(":packages:google-agones-sdk-bindings-java:shadowJar") mergeServiceFiles() } + + processBungeecordResources { + inputs.property("version", project.version) + expand("version" to project.version) + } +} + +ktlint { + filter { + exclude { + it.file.path.contains(layout.buildDirectory.dir("generated").get().toString()) + } + } +} + +buildConfig { + packageName("io.shulkermc.proxyagent") + + sourceSets.getByName("velocity") { + buildConfigField("String", "VERSION", "\"${project.version}\"") + } } diff --git a/packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml b/packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml index ddbd16d5..ed68ca9a 100644 --- a/packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml +++ b/packages/shulker-proxy-agent/src/bungeecord/resources/plugin.yml @@ -1,4 +1,4 @@ name: ShulkerProxyAgent main: io.shulkermc.proxyagent.ShulkerProxyAgent -version: 0.1.0 +version: ${version} author: Jérémy Levilain diff --git a/packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt b/packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt index 50bb6439..ac79bbf3 100644 --- a/packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt +++ b/packages/shulker-proxy-agent/src/velocity/kotlin/io/shulkermc/proxyagent/ShulkerProxyAgent.kt @@ -11,7 +11,7 @@ import java.util.logging.Logger @Plugin( id = "shulker-proxy-agent", name = "ShulkerProxyAgent", - version = "0.1.0", + version = VelocityBuildConfig.VERSION, authors = ["Jérémy Levilain "] ) class ShulkerProxyAgent @Inject constructor( diff --git a/packages/shulker-server-agent/build.gradle.kts b/packages/shulker-server-agent/build.gradle.kts index e719f60a..304fbe09 100644 --- a/packages/shulker-server-agent/build.gradle.kts +++ b/packages/shulker-server-agent/build.gradle.kts @@ -11,4 +11,9 @@ tasks { dependsOn(":packages:google-agones-sdk-bindings-java:shadowJar") mergeServiceFiles() } + + processPaperResources { + inputs.property("version", project.version) + expand("version" to project.version) + } } diff --git a/packages/shulker-server-agent/src/paper/resources/plugin.yml b/packages/shulker-server-agent/src/paper/resources/plugin.yml index a82f1e16..59242237 100644 --- a/packages/shulker-server-agent/src/paper/resources/plugin.yml +++ b/packages/shulker-server-agent/src/paper/resources/plugin.yml @@ -1,5 +1,5 @@ name: ShulkerServerAgent main: io.shulkermc.serveragent.ShulkerServerAgent -version: 0.1.0 +version: ${version} author: Jérémy Levilain api-version: 1.19