Skip to content

Commit

Permalink
Added workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Feb 10, 2024
1 parent 1acb701 commit 41d01fd
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
cache-read-only: ${{ github.ref_name != 'main' && github.ref_name != 'development' }}

- name: Publish to Maven Repository
if: ${{ github.ref_name == 'main' || github.ref_name == 'development' }}
uses: gradle/gradle-build-action@v2
env:
ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }}
ORG_GRADLE_PROJECT_geysermcPassword: ${{ secrets.DEPLOY_PASS }}
with:
arguments: publish
cache-read-only: ${{ github.ref_name != 'main' && github.ref_name != 'development' }}

- name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/DatabaseUtils' }}
uses: Tim203/actions-git-discord-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
!README.md
!LICENSE
!license_header.txt
!.github
!.github/**

# Don't ignore specific gradle files and folders
!gradle
Expand Down
4 changes: 2 additions & 2 deletions ap/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ dependencies {
annotationProcessor(libs.auto.service)

testImplementation(libs.compile.testing)
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(libs.junit.api)
testRuntimeOnly(libs.junit.engine)
}

tasks.withType<Test>().configureEach {
Expand Down
10 changes: 4 additions & 6 deletions ap/src/test/resources/test/basic/BasicRepositorySqlImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ public CompletableFuture<Void> update(TestEntity entity) {
statement.setString(1, entity.c());
statement.setInt(2, entity.a());
statement.setString(3, entity.b());
try (ResultSet result = statement.executeQuery()) {
return null;
}
statement.executeUpdate();
return null;
}
} catch (SQLException exception) {
throw new CompletionException("Unexpected error occurred", exception);
Expand All @@ -90,9 +89,8 @@ public CompletableFuture<Void> insert(TestEntity entity) {
statement.setInt(1, entity.a());
statement.setString(2, entity.b());
statement.setString(3, entity.c());
try (ResultSet result = statement.executeQuery()) {
return null;
}
statement.executeUpdate();
return null;
}
} catch (SQLException exception) {
throw new CompletionException("Unexpected error occurred", exception);
Expand Down
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
alias(libs.plugins.indra)
alias(libs.plugins.indra.publishing)
alias(libs.plugins.indra.publishing) apply false
alias(libs.plugins.indra.licenser.spotless)
}

group = "org.geysermc.databaseutils"

subprojects {
apply {
plugin("java-library")
plugin("net.kyori.indra")
plugin("net.kyori.indra.publishing")
plugin("net.kyori.indra.licenser.spotless")
}

Expand All @@ -23,6 +23,9 @@ subprojects {
mitLicense()

javaVersions { target(17) }

publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots")
publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases")
}

spotless {
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ dependencies {
testRuntimeOnly(libs.h2)
testAnnotationProcessor(projects.ap)

testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(libs.junit.api)
testRuntimeOnly(libs.junit.engine)
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ h2 = "2.2.224"
javapoet = "1.10.0"
auto-service = "1.1.1"
compile-testing = "0.21.0"
junit = "5.9.1"

indra = "3.1.3"

Expand All @@ -19,6 +20,9 @@ auto-service = { module = "com.google.auto.service:auto-service", version.ref =
javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" }
compile-testing = { module = "com.google.testing.compile:compile-testing", version.ref = "compile-testing" }

junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }

[plugins]
indra = { id = "net.kyori.indra", version.ref = "indra" }
indra-publishing = { id = "net.kyori.indra.publishing", version.ref = "indra" }
Expand Down

0 comments on commit 41d01fd

Please sign in to comment.