diff --git a/.github/workflows/build-project.yml b/.github/workflows/call-build-project.yml similarity index 85% rename from .github/workflows/build-project.yml rename to .github/workflows/call-build-project.yml index 138096c..2ee39e6 100644 --- a/.github/workflows/build-project.yml +++ b/.github/workflows/call-build-project.yml @@ -11,11 +11,11 @@ jobs: steps: - name: Checkout Git repo uses: actions/checkout@v4 - - name: Set up JDK 1.21 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: '21' + distribution: 'adopt' + java-version: 21 - name: Give gradle permission run: chmod +x gradlew - name: Build with Gradle diff --git a/.github/workflows/call-create-artifacts.yml b/.github/workflows/call-create-artifacts.yml new file mode 100644 index 0000000..4f097cb --- /dev/null +++ b/.github/workflows/call-create-artifacts.yml @@ -0,0 +1,41 @@ +name: "detekt-validation" +on: + workflow_call: + secrets: + ACTIONS_TOKEN: + required: true +jobs: + publish: + name: Build and upload + runs-on: ubuntu-latest + steps: + - name: Checkout Git repo + uses: actions/checkout@v4 + - uses: christian-draeger/read-properties@1.1.1 + id: properties + with: + path: './gradle.properties' + properties: 'makeevrserg.project.name makeevrserg.project.version.string' + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: 21 + - name: Give gradle permission + run: chmod +x gradlew + - name: Build with Gradle + uses: gradle/gradle-build-action@v3 + with: + arguments: :shadowJar --stacktrace + - name: Create release + id: create_internal_release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} + with: + files: | + ./jars/*.jar + tag_name: ${{ steps.properties.outputs.makeevrserg-project-version-string }} + name: ${{ steps.properties.outputs.makeevrserg-project-name }} - ${{ steps.properties.outputs.makeevrserg-project-version-string }} + draft: false + prerelease: false diff --git a/.github/workflows/detekt-validation.yml b/.github/workflows/call-detekt-validation.yml similarity index 93% rename from .github/workflows/detekt-validation.yml rename to .github/workflows/call-detekt-validation.yml index 95e3493..a4c6a43 100644 --- a/.github/workflows/detekt-validation.yml +++ b/.github/workflows/call-detekt-validation.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up JDK 1.21 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/call-gradle-wrapper-validation.yml similarity index 100% rename from .github/workflows/gradle-wrapper-validation.yml rename to .github/workflows/call-gradle-wrapper-validation.yml diff --git a/.github/workflows/tests-validation.yml b/.github/workflows/call-tests-validation.yml similarity index 86% rename from .github/workflows/tests-validation.yml rename to .github/workflows/call-tests-validation.yml index 1565e4e..9db21c0 100644 --- a/.github/workflows/tests-validation.yml +++ b/.github/workflows/call-tests-validation.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up JDK 1.21 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - distribution: 'temurin' + distribution: 'adopt' java-version: '21' - name: Give gradle permission run: chmod +x gradlew diff --git a/.github/workflows/check-develop.yml b/.github/workflows/check-develop.yml new file mode 100644 index 0000000..3b9512a --- /dev/null +++ b/.github/workflows/check-develop.yml @@ -0,0 +1,20 @@ +name: Check Develop +on: + push: + branches: + - develop +jobs: + gradle_validation: + name: Validate gradle wrapper + uses: ./.github/workflows/call-gradle-wrapper-validation.yml + detekt_validation: + name: Check by detekt + needs: gradle_validation + uses: ./.github/workflows/call-detekt-validation.yml + tests_validation: + needs: gradle_validation + uses: ./.github/workflows/call-tests-validation.yml + build: + name: Build project + needs: [ gradle_validation, detekt_validation,tests_validation ] + uses: ./.github/workflows/call-build-project.yml \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 36fa00b..03dfcad 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,10 +1,9 @@ -name: Pull request +name: Check Develop on: pull_request: branches: - 'develop' - 'master' - - 'prerelease/*' # Concurrency strategy: # github.workflow: distinguish this workflow from others @@ -22,15 +21,15 @@ concurrency: jobs: gradle_validation: name: Validate gradle wrapper - uses: ./.github/workflows/gradle-wrapper-validation.yml + uses: ./.github/workflows/call-gradle-wrapper-validation.yml detekt_validation: name: Check by detekt needs: gradle_validation - uses: ./.github/workflows/detekt-validation.yml + uses: ./.github/workflows/call-detekt-validation.yml tests_validation: needs: gradle_validation - uses: ./.github/workflows/tests-validation.yml + uses: ./.github/workflows/call-tests-validation.yml build: name: Build project needs: [ gradle_validation, detekt_validation, tests_validation ] - uses: ./.github/workflows/build-project.yml \ No newline at end of file + uses: ./.github/workflows/call-build-project.yml \ No newline at end of file diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml new file mode 100644 index 0000000..5a5edec --- /dev/null +++ b/.github/workflows/release-master.yml @@ -0,0 +1,13 @@ +name: CI +on: + push: + branches: + - master +jobs: + gradle_validation: + uses: ./.github/workflows/call-gradle-wrapper-validation.yml + create_artifact: + needs: [ gradle_validation ] + uses: ./.github/workflows/call-create-artifacts.yml + secrets: + ACTIONS_TOKEN: ${{ secrets.ACTIONS_TOKEN }} diff --git a/gradle.properties b/gradle.properties index 97c5485..0ee7f26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ makeevrserg.java.ktarget=21 # Project makeevrserg.project.name=AstraTemplate makeevrserg.project.group=ru.astrainteractive.astratemplate -makeevrserg.project.version.string=7.3.0 +makeevrserg.project.version.string=7.4.0 makeevrserg.project.description=Template plugin for EmpireProjekt makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com makeevrserg.project.url=https://github.com/Astra-Interactive/AstraTemplate diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c430f6c..de43967 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ minecraft-protocollib = "5.1.0" minecraft-wg = "7.0.7" minecraft-vault = "1.7.1" # https://github.com/MilkBowl/VaultAPI minecraft-coreprotect = "21.2" -minecraft-astralibs = "3.5.1" +minecraft-astralibs = "3.6.0" minecraft-bstats = "3.0.2" minecraft-mockbukkit = "3.86.1" @@ -49,7 +49,6 @@ exposed = "0.50.1" exposed = ["exposed-java-time", "exposed-jdbc", "exposed-dao", "exposed-core"] minecraft-bukkit = ["minecraft-paper-api", "minecraft-spigot-api", "minecraft-spigot-core", "minecraft-vaultapi", "minecraft-papi"] testing-kotlin = ["kotlin-coroutines-core", "kotlin-coroutines-coreJvm", "driver-jdbc", "driver-mysql", "kotlin-serialization", "kotlin-serializationJson"] -testing-libs = ["tests-junit-jupiter-api", "tests-org-testing", "tests-junit5", "tests-junit-jupiter"] kotlin = ["kotlin-coroutines-core", "kotlin-coroutines-coreJvm", "kotlin-serialization", "kotlin-serializationJson", "kotlin-serializationKaml", "kotlin-tooling-core"] [libraries] @@ -63,6 +62,9 @@ kotlin-serializationKaml = { module = "com.charleskorn.kaml:kaml", version.ref = kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-version" } kotlin-tooling-core = { module = "org.jetbrains.kotlin:kotlin-tooling-core", version.ref = "kotlin-version" } +# Testing +tests-kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } + # Shadow gradle-shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "gradle-shadow" } diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/modules/core/build.gradle.kts b/modules/core/build.gradle.kts index 4e4d62c..078a469 100644 --- a/modules/core/build.gradle.kts +++ b/modules/core/build.gradle.kts @@ -10,4 +10,7 @@ dependencies { implementation(libs.minecraft.astralibs.core) // klibs implementation(klibs.klibs.kdi) + // Test + testImplementation(libs.bundles.testing.kotlin) + testImplementation(libs.tests.kotlin.test) } diff --git a/modules/core/src/test/kotlin/ru/astrainteractive/astratemplate/core/di/factory/MainConfigurationFactoryTest.kt b/modules/core/src/test/kotlin/ru/astrainteractive/astratemplate/core/di/factory/MainConfigurationFactoryTest.kt new file mode 100644 index 0000000..ae21469 --- /dev/null +++ b/modules/core/src/test/kotlin/ru/astrainteractive/astratemplate/core/di/factory/MainConfigurationFactoryTest.kt @@ -0,0 +1,15 @@ +package ru.astrainteractive.astratemplate.core.di.factory + +import ru.astrainteractive.astralibs.serialization.YamlStringFormat +import java.io.File +import kotlin.test.Test + +class MainConfigurationFactoryTest { + @Test + fun GIVEN_default_factory_WHEN_call_THEN_no_throw() { + MainConfigurationFactory( + dataFolder = File(System.getProperty("java.io.tmpdir")), + stringFormat = YamlStringFormat() + ).create() + } +} diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index 857d726..5d8eb54 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -25,6 +25,11 @@ dependencies { } setupVelocityProcessor() -setupSpigotShadow(File("D:\\Minecraft Servers\\Servers\\esmp-configuration\\velocity\\plugins")) { + +val destination = File("C:\\Users\\Roman\\Desktop\\ForgeTest\\mods") + .takeIf(File::exists) + ?: File(rootDir, "jars") + +setupSpigotShadow(destination) { archiveBaseName.set("${requireProjectInfo.name}-velocity") }