Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto eol=lf
gradlew text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
gradle-wrapper.jar -text -diff -merge -filter
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "maven"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
62 changes: 29 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,49 @@ on:
milestone:
types: [closed]
jobs:
build:
release:
name: Release ${{ github.event.milestone.title }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: master
fetch-depth: 0
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Set up Git
run: |
git config user.name "Zonky Bot"
git config user.email "bot@zonky.com"
- name: Set up JDK
uses: actions/setup-java@v4
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 8
server-id: ossrh
server-username: MAVEN_USER
server-password: MAVEN_PASS
gpg-private-key: ${{ secrets.SIGNING_CERT }}
gpg-passphrase: SIGNING_PASS
- name: Release with Maven
java-version: '17'
cache: 'gradle'
- name: Make Gradle wrapper executable
run: chmod +x gradlew
- name: Publish to Maven Central via Gradle
env:
RELEASE_VERSION: ${{ github.event.milestone.title }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
SIGNING_PASS: ${{ secrets.SIGNING_PASS }}
run: mvn -B release:prepare release:perform -DreleaseVersion=$RELEASE_VERSION
- name: Upload staged artifacts to Central Sonatype
# Gradle signing plugin (build.gradle.kts)
MAVEN_SIGNING_KEY: ${{ secrets.SIGNING_CERT }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASS }}
# nmcp credentials (build.gradle.kts)
USERNAME_TOKEN: ${{ secrets.MAVEN_USER }}
PASSWORD_TOKEN: ${{ secrets.MAVEN_PASS }}
# Use the milestone title as the build's version without touching gradle.properties
run: |
./gradlew \
-Pversion=$RELEASE_VERSION \
clean check publishAllPublicationsToCentralPortal \
--stacktrace
# Reproduces Maven Release Plugin’s v@{project.version} tag
- name: Tag release
if: success()
env:
SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASS }}
RELEASE_VERSION: ${{ github.event.milestone.title }}
run: |
SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64)
PUBLISH_NAMESPACE="io.zonky"
echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..."
RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \
-H "Authorization: Bearer $SONATYPE_TOKEN" \
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed")
if [ "$RESPONSE" -ne 200 ]; then
echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: "
cat response_body.txt
echo "Visit https://central.sonatype.com/publishing/deployments for more information."
exit 1
else
echo "Artifacts were uploaded successfully to Central Sonatype."
echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts."
fi
git tag "v$RELEASE_VERSION"
git push origin "v$RELEASE_VERSION"
26 changes: 15 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17, 21, 22] # LTS and newer versions
java: [17, 21, 25] # LTS and newer versions
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B test
- name: Checkout project
uses: actions/checkout@v5
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'gradle'
- name: Make Gradle wrapper executable
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew check
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ target/
.project
.settings
dist/
.gradle/
build/
out/
classes/
13 changes: 13 additions & 0 deletions HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright ${CREATION_YEAR} Tomas Vanek

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
181 changes: 181 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import enforcer.rules.DependencyConvergence
import org.apache.tools.ant.taskdefs.condition.Os

plugins {
`java-library`
`maven-publish`
signing
pmd
id("dev.yumi.gradle.licenser")
id("com.gradleup.nmcp")
id("de.aaschmid.cpd")
id("org.kordamp.gradle.project-enforcer")
}

val projectName = providers.gradleProperty("name")
val projectGroup = providers.gradleProperty("group")
val projectVersion = providers.gradleProperty("version")

val javaVersion = providers.gradleProperty("java_version")

val embeddedPostgresBinariesVersion = providers.gradleProperty("embedded_postgres_binaries_version")
val commonsCodecVersion = providers.gradleProperty("commons_codec_version")
val commonsCompressVersion = providers.gradleProperty("commons_compress_version")
val commonsIoVersion = providers.gradleProperty("commons_io_version")
val commonsLang3Version = providers.gradleProperty("commons_lang3_version")
val flywayVersion = providers.gradleProperty("flyway_version")
val junit4Version = providers.gradleProperty("junit4_version")
val junit5Version = providers.gradleProperty("junit5_version")
val liquibaseVersion = providers.gradleProperty("liquibase_version")
val mockitoVersion = providers.gradleProperty("mockito_version")
val pmdVersion = providers.gradleProperty("pmd_version")
val postgresqlVersion = providers.gradleProperty("postgresql_version")
val slf4jVersion = providers.gradleProperty("slf4j_version")
val xzVersion = providers.gradleProperty("xz_version")

description = "Embedded PostgreSQL Server"
base.archivesName = projectName.get()
group = projectGroup.get()
version = projectVersion.get()

repositories { mavenCentral() }

dependencies {
runtimeOnly("io.zonky.test.postgres:embedded-postgres-binaries-windows-amd64:${embeddedPostgresBinariesVersion.get()}")
runtimeOnly("io.zonky.test.postgres:embedded-postgres-binaries-darwin-amd64:${embeddedPostgresBinariesVersion.get()}")
runtimeOnly("io.zonky.test.postgres:embedded-postgres-binaries-linux-amd64:${embeddedPostgresBinariesVersion.get()}")
runtimeOnly("io.zonky.test.postgres:embedded-postgres-binaries-linux-amd64-alpine:${embeddedPostgresBinariesVersion.get()}")

implementation("org.slf4j:slf4j-api:${slf4jVersion.get()}")
implementation("org.apache.commons:commons-lang3:${commonsLang3Version.get()}")
implementation("org.apache.commons:commons-compress:${commonsCompressVersion.get()}")
implementation("org.tukaani:xz:${xzVersion.get()}")
implementation("commons-io:commons-io:${commonsIoVersion.get()}")
implementation("commons-codec:commons-codec:${commonsCodecVersion.get()}")
implementation("org.postgresql:postgresql:${postgresqlVersion.get()}")

compileOnly("org.flywaydb:flyway-core:${flywayVersion.get()}")
compileOnly("org.liquibase:liquibase-core:${liquibaseVersion.get()}")
compileOnly("junit:junit:${junit4Version.get()}")
compileOnly("org.junit.jupiter:junit-jupiter-api:${junit5Version.get()}")

testImplementation("org.flywaydb:flyway-core:${flywayVersion.get()}")
testImplementation("org.liquibase:liquibase-core:${liquibaseVersion.get()}")
testImplementation(platform("org.junit:junit-bom:${junit5Version.get()}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("junit:junit:${junit4Version.get()}")
testImplementation("org.mockito:mockito-core:${mockitoVersion.get()}")

testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.slf4j:slf4j-simple:${slf4jVersion.get()}")
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(javaVersion.get())
sourceCompatibility = JavaVersion.toVersion(javaVersion.get().toInt())
targetCompatibility = JavaVersion.toVersion(javaVersion.get().toInt())
withSourcesJar()
withJavadocJar()
}
tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:deprecation")
sourceCompatibility = javaVersion.get()
targetCompatibility = javaVersion.get()
if (javaVersion.get().toInt() > 8) options.release = javaVersion.get().toInt()
}
withType<Javadoc>().configureEach {
options.encoding = "UTF-8"
val standardOptions = options as StandardJavadocDocletOptions
standardOptions.addStringOption("Xdoclint:none", "-quiet")
}
withType<JavaExec>().configureEach { defaultCharacterEncoding = "UTF-8" }
withType<Test>().configureEach {
defaultCharacterEncoding = "UTF-8"
useJUnitPlatform()
if (!Os.isFamily(Os.FAMILY_WINDOWS)) environment("LC_ALL", System.getenv("LC_ALL") ?: "en_US.UTF-8")
}
named("check") { dependsOn("cpdCheck") }
}
pmd {
toolVersion = pmdVersion.get()
isConsoleOutput = true
isIgnoreFailures = false
rulesMinimumPriority = 4
}
cpd {
toolVersion = pmdVersion.get()
isIgnoreFailures = true
minimumTokenCount = 100
encoding = "UTF-8"
}
enforce {
rule(DependencyConvergence::class.java) {
failOnDynamicVersions = true
failOnChangingVersions = true
failOnNonReproducibleResolution = true
}
}
license {
rule(file("./HEADER"))
include("**/*.java")
exclude("**/*.properties")
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
groupId = project.group.toString()
artifactId = base.archivesName.get()
version = project.version.toString()
pom {
name = projectName
description = project.description
url = "https://github.com/zonkyio/embedded-postgres"

licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
name = "Tomas Vanek"
email = "tomix26@gmail.com"
}
developer {
name = "Zonky Developers"
email = "developers@zonky.cz"
}
}
scm {
url = "https://github.com/zonkyio/embedded-postgres"
connection = "scm:git:https://github.com/zonkyio/embedded-postgres.git"
developerConnection = "scm:git:https://github.com/zonkyio/embedded-postgres.git"
tag = "HEAD"
}
}
}
}
}
signing {
val signingKey = System.getenv("MAVEN_SIGNING_KEY")
val signingPassphrase = System.getenv("MAVEN_SIGNING_PASSPHRASE")
if (!signingKey.isNullOrBlank()) {
isRequired = true
useInMemoryPgpKeys(signingKey, signingPassphrase)
sign(publishing.publications)
} else {
isRequired = false
}
}
nmcp {
publishAllPublicationsToCentralPortal {
username = System.getenv("USERNAME_TOKEN") ?: ""
password = System.getenv("PASSWORD_TOKEN") ?: ""
}
}
54 changes: 54 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
##########################################################################
# Standard Properties
org.gradle.jvmargs = -Xmx1G -Dfile.encoding=UTF-8
org.gradle.warning.mode = all
org.gradle.configuration-cache = false
##########################################################################
# Maven Properties
group = io.zonky.test
name = embedded-postgres
version = 2.1.2-SNAPSHOT
##########################################################################
# Java Version
java_version = 8
##########################################################################
# Dependency Versions
# Check this on https://central.sonatype.com/artifact/io.zonky.test.postgres/embedded-postgres-binaries-bom/
embedded_postgres_binaries_version = 14.19.0
# Check this on https://central.sonatype.com/artifact/commons-codec/commons-codec/
commons_codec_version = 1.19.0
# Check this on https://central.sonatype.com/artifact/org.apache.commons/commons-compress/
commons_compress_version = 1.28.0
# Check this on https://central.sonatype.com/artifact/commons-io/commons-io/
commons_io_version = 2.21.0
# Check this on https://central.sonatype.com/artifact/org.apache.commons/commons-lang3/
commons_lang3_version = 3.19.0
# Check this on https://central.sonatype.com/artifact/org.flywaydb/flyway-core/
flyway_version = 9.22.3
# Check this on https://central.sonatype.com/artifact/org.junit.jupiter/junit-jupiter-api/
junit5_version = 5.14.1
# Check this on https://central.sonatype.com/artifact/junit/junit/
junit4_version = 4.13.2
# Check this on https://central.sonatype.com/artifact/org.liquibase/liquibase-core/
liquibase_version = 4.33.0
# Check this on https://central.sonatype.com/artifact/org.mockito/mockito-core/
mockito_version = 4.11.0
# Check this on https://central.sonatype.com/artifact/net.sourceforge.pmd/pmd/
pmd_version = 7.18.0
# Check this on https://central.sonatype.com/artifact/org.postgresql/postgresql/
postgresql_version = 42.7.8
# Check this on https://central.sonatype.com/artifact/org.slf4j/slf4j-api/
slf4j_version = 1.7.36
# Check this on https://central.sonatype.com/artifact/org.tukaani/xz/
xz_version = 1.10
##########################################################################
# Plugin Versions
# Check this on https://plugins.gradle.org/plugin/dev.yumi.gradle.licenser/
yumi_gradle_licenser_version = 2.2.1
# Check this on https://github.com/GradleUp/nmcp/releases/latest/
nmcp_version = 1.2.0
# Check this on https://github.com/aaschmid/gradle-cpd-plugin/releases/latest/
cpd_version = 3.5
# Check this on https://github.com/kordamp/enforcer-gradle-plugin/releases/latest/
enforcer_gradle_version = 0.14.0
##########################################################################
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading