Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c462c71
refactor: add toEnv method to server, improve error logging
dayyeeet Jul 14, 2024
1374d18
feat: pub sub
FllipEis Aug 17, 2024
41bce3c
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Aug 17, 2024
d931fbf
refactor: upgrade to kotlin 2.0.20, java 22, new grpc defs
dayyeeet Oct 1, 2024
d56405b
refactor: rename fields to match proto defs
dayyeeet Oct 1, 2024
be2adad
impl: pubsub events for server start, stop and update
dayyeeet Oct 2, 2024
ad6ee4b
refactor: fix pubsub events
dayyeeet Oct 5, 2024
cf525f7
refactor: minimize controller-runtime build
dayyeeet Oct 6, 2024
cb69aba
feat: ServerApi#getServerByNumerical
FllipEis Oct 7, 2024
6c0ffb7
update: controller version for api
FllipEis Oct 7, 2024
f004ce3
Merge remote-tracking branch 'origin/develop' into develop
FllipEis Oct 7, 2024
bcc8508
refactor: minimize controller-runtime build
dayyeeet Oct 7, 2024
7e789ca
Merge remote-tracking branch 'origin/develop' into develop
dayyeeet Oct 7, 2024
2e76659
refactor: upgrade runtime to coroutines
dayyeeet Oct 9, 2024
bffc980
refactor: controller api with coroutines
FllipEis Oct 9, 2024
ce568d1
refactor: reconciler now works with coroutines
FllipEis Oct 9, 2024
f33dcb1
refactor: start using coroutines for jooq
FllipEis Oct 9, 2024
17d4c0b
fix: reuse connections to fix all known connection bugs
dayyeeet Oct 12, 2024
fef31f8
Merge remote-tracking branch 'origin/develop' into develop
dayyeeet Oct 12, 2024
b571a54
feat: env property file, dev workflow
dayyeeet Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Create Release with ShadowJars

on:
workflow_dispatch:

jobs:
build:
name: Build ShadowJars and Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: develop # Ensure it works from the develop branch

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '21'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build ShadowJars
run: ./gradlew clean build shadowJar

- name: Get Gradle Version
id: gradle_version
run: echo "GRADLE_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV

- name: Get Commit Hash
id: commit_hash
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }}
release_name: v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }}
draft: false
prerelease: true
commitish: develop
body: |
This release contains dev builds for all Gradle modules.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload ShadowJars to Release
run: |
# Find JAR files in any submodule's build/libs directory
for jar in $(find . -type f -name "*.jar" -path "*/build/libs/*.jar" -not -path "./build/libs/*"); do
# Check if the filename contains a version number (e.g., a dash followed by numbers)
if [[ $(basename "$jar") =~ -[0-9]+\.[0-9]+ ]]; then
echo "Skipping $jar due to version number"
else
echo "Uploading $jar"
gh release upload v${{ env.GRADLE_VERSION }}-dev.${{ env.COMMIT_HASH }} "$jar"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 6 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin)
Expand All @@ -10,7 +9,7 @@ plugins {

allprojects {
group = "app.simplecloud.controller"
version = "0.0.27-EXPERIMENTAL"
version = "0.0.30"

repositories {
mavenCentral()
Expand All @@ -20,7 +19,7 @@ allprojects {

subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.gradleup.shadow")
apply(plugin = "net.thebugmc.gradle.sonatype-central-portal-publisher")
apply(plugin = "maven-publish")

Expand All @@ -42,11 +41,10 @@ subprojects {
}

kotlin {
jvmToolchain(17)
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
jvmToolchain(21)
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
}

tasks.named("shadowJar", ShadowJar::class) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,89 @@
package app.simplecloud.controller.api

import app.simplecloud.controller.api.impl.ControllerApiImpl
import app.simplecloud.controller.api.impl.coroutines.ControllerApiCoroutineImpl
import app.simplecloud.controller.api.impl.future.ControllerApiFutureImpl
import app.simplecloud.pubsub.PubSubClient

interface ControllerApi {

/**
* @return the Controller [GroupApi]
*/
fun getGroups(): GroupApi
interface Future {

/**
* @return the Controller [ServerApi]
*/
fun getServers(): ServerApi
/**
* @return the Controller [GroupApi.Future]
*/
fun getGroups(): GroupApi.Future

/**
* @return the Controller [ServerApi.Future]
*/
fun getServers(): ServerApi.Future

/**
* @return the [PubSubClient] to subscribe to Controller events and send messages
*/
fun getPubSubClient(): PubSubClient

}

interface Coroutine {

/**
* @return the Controller [GroupApi.Coroutine]
*/
fun getGroups(): GroupApi.Coroutine

/**
* @return the Controller [ServerApi.Coroutine]
*/
fun getServers(): ServerApi.Coroutine

/**
* @return the [PubSubClient] to subscribe to Controller events and send messages
*/
fun getPubSubClient(): PubSubClient

}

companion object {

/**
* Creates a new [ControllerApi] instance
* @return the created [ControllerApi]
* Creates a new [ControllerApi.Future] instance
* @return the created [ControllerApi.Future]
*/
@JvmStatic
fun createFutureApi(): Future {
val authSecret = System.getenv("CONTROLLER_SECRET")
return createFutureApi(authSecret)
}

/**
* Creates a new [ControllerApi.Future] instance
* @param authSecret the authentication key used by the Controller
* @return the created [ControllerApi.Future]
*/
@JvmStatic
fun createFutureApi(authSecret: String): Future {
return ControllerApiFutureImpl(authSecret)
}

/**
* Creates a new [ControllerApi.Coroutine] instance
* @return the created [ControllerApi.Coroutine]
*/
@JvmStatic
fun create(): ControllerApi {
fun createCoroutineApi(): Coroutine {
val authSecret = System.getenv("CONTROLLER_SECRET")
return create(authSecret)
return createCoroutineApi(authSecret)
}

/**
* Creates a new [ControllerApi] instance
* Creates a new [ControllerApi.Coroutine] instance
* @param authSecret the authentication key used by the Controller
* @return the created [ControllerApi]
* @return the created [ControllerApi.Coroutine]
*/
@JvmStatic
fun create(authSecret: String): ControllerApi {
return ControllerApiImpl(authSecret)
fun createCoroutineApi(authSecret: String): Coroutine {
return ControllerApiCoroutineImpl(authSecret)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,80 @@ import java.util.concurrent.CompletableFuture

interface GroupApi {

/**
* @param name the name of the group.
* @return a [CompletableFuture] with the [Group].
*/
fun getGroupByName(name: String): CompletableFuture<Group>

/**
* @param name the name of the group.
* @return the deleted [Group].
*/
fun deleteGroup(name: String): CompletableFuture<Group>

/**
* @param group the [Group] to create.
* @return the created [Group].
*/
fun createGroup(group: Group): CompletableFuture<Group>

/**
* @param group the [Group] to update.
* @return the updated [Group].
*/
fun updateGroup(group: Group): CompletableFuture<Group>
/**
* @return a [CompletableFuture] with a list of all groups.
*/
fun getAllGroups(): CompletableFuture<List<Group>>

/**
* @param type the [ServerType] of the group
* @return a [CompletableFuture] with a list of all groups matching this type.
*/
fun getGroupsByType(type: ServerType): CompletableFuture<List<Group>>
interface Future {

/**
* @param name the name of the group.
* @return a [CompletableFuture] with the [Group].
*/
fun getGroupByName(name: String): CompletableFuture<Group>

/**
* @param name the name of the group.
* @return the deleted [Group].
*/
fun deleteGroup(name: String): CompletableFuture<Group>

/**
* @param group the [Group] to create.
* @return the created [Group].
*/
fun createGroup(group: Group): CompletableFuture<Group>

/**
* @param group the [Group] to update.
* @return the updated [Group].
*/
fun updateGroup(group: Group): CompletableFuture<Group>
/**
* @return a [CompletableFuture] with a list of all groups.
*/
fun getAllGroups(): CompletableFuture<List<Group>>

/**
* @param type the [ServerType] of the group
* @return a [CompletableFuture] with a list of all groups matching this type.
*/
fun getGroupsByType(type: ServerType): CompletableFuture<List<Group>>

}

interface Coroutine {

/**
* @param name the name of the group.
* @return the [Group].
*/
suspend fun getGroupByName(name: String): Group

/**
* @param name the name of the group.
* @return the deleted [Group].
*/
suspend fun deleteGroup(name: String): Group

/**
* @param group the [Group] to create.
* @return the created [Group].
*/
suspend fun createGroup(group: Group): Group

/**
* @param group the [Group] to update.
* @return the updated [Group].
*/
suspend fun updateGroup(group: Group): Group
/**
* @return a list of all groups.
*/
suspend fun getAllGroups(): List<Group>

/**
* @param type the [ServerType] of the group
* @return a list of all groups matching this type.
*/
suspend fun getGroupsByType(type: ServerType): List<Group>

}

}
Loading
Loading