Compare commits

17 Commits

Author SHA1 Message Date
4ed5482b63 Merge pull request 'add package publishing and CI/CD using Gitea actions' (#5) from feat/ci-cd into master
All checks were successful
github-mirror / push-github (push) Successful in 4s
Build / Gradle-Build (push) Successful in 1m32s
Test / Gradle-Test (push) Successful in 21s
Reviewed-on: #5
2024-11-16 12:41:24 +00:00
4d20dd65f2 upload test results instead of non working publishing
All checks were successful
github-mirror / push-github (push) Successful in 4s
Build / Gradle-Build (push) Successful in 1m9s
Test / Gradle-Test (push) Successful in 1m15s
2024-11-15 11:46:58 +01:00
2ab30a2bc1 switch to comma seperation
Some checks failed
github-mirror / push-github (push) Successful in 4s
Build / Gradle-Build (push) Successful in 1m9s
Test / Gradle-Test (push) Failing after 1m19s
2024-11-14 14:32:55 +01:00
420408fbdf switch to java-junit reporter
Some checks failed
github-mirror / push-github (push) Successful in 4s
Build / Gradle-Build (push) Successful in 1m8s
Test / Gradle-Test (push) Failing after 1m17s
2024-11-14 14:11:57 +01:00
df10c54767 fix variable usage
Some checks failed
github-mirror / push-github (push) Successful in 5s
Build / Gradle-Build (push) Successful in 2m1s
Test / Gradle-Test (push) Failing after 1m16s
2024-11-14 13:54:12 +01:00
18d85edcf2 fix formatting
Some checks are pending
Test / Gradle-Test (push) Waiting to run
github-mirror / push-github (push) Successful in 5s
Build / Gradle-Build (push) Successful in 1m11s
2024-11-14 13:05:36 +01:00
b371ea8520 add setup gradle step
All checks were successful
github-mirror / push-github (push) Successful in 6s
Build / Gradle-Build (push) Successful in 2m2s
2024-11-14 12:45:43 +01:00
b28406b16b update artifact directory structure
All checks were successful
github-mirror / push-github (push) Successful in 6s
Build / Gradle-Build (push) Successful in 1m6s
2024-11-14 12:38:31 +01:00
f31292c5b7 switch artifact action to gitea one
All checks were successful
github-mirror / push-github (push) Successful in 11s
Build / Gradle Build (push) Successful in 7m57s
2024-11-14 12:23:41 +01:00
de83137886 add first version of CI with build, test and publish
Some checks failed
github-mirror / push-github (push) Successful in 4s
Build / Gradle Build (push) Failing after 7m19s
2024-11-14 11:53:08 +01:00
fd3933df25 add publications
All checks were successful
github-mirror / push-github (push) Successful in 4s
2024-11-13 10:22:25 +01:00
c00b6033cc rename package in wrapper-javacord
All checks were successful
github-mirror / push-github (push) Successful in 4s
2024-11-13 10:08:55 +01:00
186fa10684 Merge pull request 'Add Button Interaction Implementation' (#4) from feat/buttons into master
All checks were successful
github-mirror / push-github (push) Successful in 4s
Reviewed-on: #4
2024-11-08 13:41:21 +00:00
7d378e6451 set fetch depth 0
All checks were successful
github-mirror / push-github (push) Successful in 4s
2024-11-07 12:42:09 +01:00
f835cfa500 change runs-on
Some checks failed
github-mirror / push-github (push) Failing after 4s
2024-11-07 12:22:41 +01:00
cb8b799000 add github mirror action
Some checks are pending
github-mirror / push-github (push) Waiting to run
2024-11-07 12:21:14 +01:00
fcc99597e6 remove unused imports 2024-11-07 11:51:43 +01:00
12 changed files with 216 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
name: github-mirror
on: push
jobs:
push-github:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to GitHub
uses: pixta-dev/repository-mirroring-action@v1
with:
target_repo_url:
git@github.com:EkiciLP/Marinara.git
ssh_private_key:
${{ secrets.MIRROR_SSH_PRIVATE_KEY }}

View File

@@ -0,0 +1,47 @@
name: Build
on:
push:
jobs:
Gradle-Build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
check-latest: true
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary: always
cache-cleanup: on-success
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
run: chmod +x gradlew; ./gradlew assemble
- name: Move artifacts
run: mkdir artifacts; mv lib/build/libs/*.jar artifacts; mv wrapper/javacord/build/libs/*.jar artifacts;
- name: Upload artifact
uses: christopherhx/gitea-upload-artifact@v4
with:
name: artifacts
path: artifacts

View File

@@ -0,0 +1,40 @@
name: Test
on:
push:
branches: [master]
jobs:
Gradle-Test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
check-latest: true
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary: always
cache-cleanup: on-success
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Publish
env:
GITEA_TOKEN: ${{ secrets.PUBLISH_PACKAGE_TOKEN }}
run: chmod +x gradlew; ./gradlew publishAllPublicationsToGiteaRepository

View File

@@ -0,0 +1,53 @@
name: Test
on:
push:
jobs:
Gradle-Test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
check-latest: true
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary: always
cache-cleanup: on-success
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test
env:
DISCORD_TEST_TOKEN: ${{ secrets.DISCORD_TOKEN }}
run: chmod +x gradlew; ./gradlew test
- name: Move Test Results
if: always()
run: |
mkdir test-results/;
[ -d lib/build/test-results/test/ ] && mv lib/build/test-results/test/*.xml test-results/;
[ -d wrapper/javacord/build/test-results/test/ ] && mv wrapper/javacord/build/test-results/test/*.xml test-results/;
- name: Upload Test Result
uses: christopherhx/gitea-upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/

50
build.gradle.kts Normal file
View File

@@ -0,0 +1,50 @@
import java.io.ByteArrayOutputStream
plugins {
`maven-publish`
}
allprojects {
group = "net.tomatentum.Marinara"
version = "1.0.0-RC1" + (if (!project.hasProperty("release")) ("-" + getGitHash()) else "")
description = "A simple but powerful, library-agnostic Discord Interaction Wrapper."
}
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "java-library")
plugins.withType<MavenPublishPlugin> {
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
repositories {
maven {
name = "Gitea"
url = uri("https://git.tomatentum.net/api/packages/tueem/maven/")
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = "token " + System.getenv("GITEA_TOKEN")
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
}
}
}
fun getGitHash(): String {
val output = ByteArrayOutputStream()
project.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = output
}
return output.toString().trim()
}

1
gradle.properties Normal file
View File

@@ -0,0 +1 @@
org.gradle.caching=true

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

0
gradlew vendored Normal file → Executable file
View File

View File

@@ -11,5 +11,7 @@ plugins {
} }
rootProject.name = "Marinara" rootProject.name = "Marinara"
include("lib") include(":lib")
include("wrapper:javacord") include(":wrapper-javacord")
project(":wrapper-javacord").projectDir = file("wrapper/javacord")

View File

@@ -1,4 +1,4 @@
package net.tomatentum.marinare.wrapper.javacord; package net.tomatentum.marinara.wrapper.javacord;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -14,7 +14,6 @@ import org.javacord.api.interaction.ButtonInteraction;
import org.javacord.api.interaction.SlashCommandBuilder; import org.javacord.api.interaction.SlashCommandBuilder;
import org.javacord.api.interaction.SlashCommandInteraction; import org.javacord.api.interaction.SlashCommandInteraction;
import org.javacord.api.interaction.SlashCommandInteractionOption; import org.javacord.api.interaction.SlashCommandInteractionOption;
import org.javacord.core.entity.user.Member;
import io.leangen.geantyref.AnnotationFormatException; import io.leangen.geantyref.AnnotationFormatException;
import io.leangen.geantyref.TypeFactory; import io.leangen.geantyref.TypeFactory;

View File

@@ -10,7 +10,7 @@ import net.tomatentum.marinara.Marinara;
import net.tomatentum.marinara.test.mocks.ButtonInteractionMock; import net.tomatentum.marinara.test.mocks.ButtonInteractionMock;
import net.tomatentum.marinara.test.mocks.DiscordApiMock; import net.tomatentum.marinara.test.mocks.DiscordApiMock;
import net.tomatentum.marinara.wrapper.LibraryWrapper; import net.tomatentum.marinara.wrapper.LibraryWrapper;
import net.tomatentum.marinare.wrapper.javacord.JavacordWrapper; import net.tomatentum.marinara.wrapper.javacord.JavacordWrapper;
@TestInstance(Lifecycle.PER_CLASS) @TestInstance(Lifecycle.PER_CLASS)
public class ButtonTest { public class ButtonTest {

View File

@@ -11,7 +11,7 @@ import org.junit.jupiter.api.TestInstance.Lifecycle;
import net.tomatentum.marinara.Marinara; import net.tomatentum.marinara.Marinara;
import net.tomatentum.marinara.test.mocks.SlashCommandInteractionMock; import net.tomatentum.marinara.test.mocks.SlashCommandInteractionMock;
import net.tomatentum.marinara.wrapper.LibraryWrapper; import net.tomatentum.marinara.wrapper.LibraryWrapper;
import net.tomatentum.marinare.wrapper.javacord.JavacordWrapper; import net.tomatentum.marinara.wrapper.javacord.JavacordWrapper;
@TestInstance(Lifecycle.PER_CLASS) @TestInstance(Lifecycle.PER_CLASS)
public class SlashCommandTest { public class SlashCommandTest {