Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] #1922 to 1.0 branch #1966

Merged
merged 1 commit into from
Jul 18, 2024
Merged
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
19 changes: 4 additions & 15 deletions .github/workflows/java-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,21 @@ jobs:
OS: ubuntu,
RUNNER: ubuntu-latest,
TARGET: x86_64-unknown-linux-gnu,
CLASSIFIER: linux-x86_64
}
- {
OS: ubuntu,
RUNNER: ["self-hosted", "Linux", "ARM64"],
TARGET: aarch64-unknown-linux-gnu,
CLASSIFIER: linux-aarch_64,
CONTAINER: "2_28"
}
- {
OS: macos,
RUNNER: macos-12,
TARGET: x86_64-apple-darwin,
CLASSIFIER: osx-x86_64
}
- {
OS: macos,
RUNNER: macos-latest,
TARGET: aarch64-apple-darwin,
CLASSIFIER: osx-aarch_64
}

runs-on: ${{ matrix.host.RUNNER }}
Expand Down Expand Up @@ -139,18 +134,12 @@ jobs:
env:
SECRING_GPG: ${{ secrets.SECRING_GPG }}

- name: Replace placeholders and version in build.gradle
shell: bash
working-directory: ./java/client
run: |
SED_FOR_MACOS=`if [[ "${{ matrix.host.os }}" =~ .*"macos".* ]]; then echo "''"; fi`
sed -i $SED_FOR_MACOS 's/placeholder/${{ matrix.host.CLASSIFIER }}/g' build.gradle
sed -i $SED_FOR_MACOS "s/255.255.255/${{ env.RELEASE_VERSION }}/g" build.gradle

- name: Build java client
working-directory: java
run: |
./gradlew :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg -Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }}
env:
GLIDE_RELEASE_VERSION: ${{ env.RELEASE_VERSION }}

- name: Bundle JAR
working-directory: java
Expand All @@ -160,12 +149,12 @@ jobs:
jar -cvf bundle.jar *
ls -ltr
cd -
cp $src_folder/bundle.jar .
cp $src_folder/bundle.jar bundle-${{ matrix.host.TARGET }}.jar

- name: Upload artifacts to publish
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.host.TARGET }}
path: |
java/bundle.jar
java/bundle*.jar
14 changes: 5 additions & 9 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

- name: Build java client
working-directory: java
run: ./gradlew --continue build
run: ./gradlew --continue build -x javadoc

- name: Ensure no skipped files by linter
working-directory: java
Expand Down Expand Up @@ -163,22 +163,18 @@ jobs:

- name: Install Java
run: |
yum install -y java-${{ matrix.java }}
yum install -y java-${{ matrix.java }}-amazon-corretto-devel.x86_64

- name: Build rust part
- name: Build java wrapper
working-directory: java
run: cargo build --release

- name: Build java part
working-directory: java
run: ./gradlew --continue build
run: ./gradlew --continue build -x javadoc

- name: Upload test & spotbugs reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.java }}
name: test-reports-${{ matrix.java }}-amazon-linux
path: |
java/client/build/reports/**
java/integTest/build/reports/**
Expand Down
35 changes: 28 additions & 7 deletions java/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id ("com.github.spotbugs") version "6.0.18"
id 'io.freefair.lombok' version '8.6'
id 'com.github.spotbugs' version '6.0.18'
id 'com.google.osdetector' version '1.7.3'
}

repositories {
Expand Down Expand Up @@ -156,7 +158,11 @@ tasks.register('copyNativeLib', Copy) {
into sourceSets.main.output.resourcesDir
}

def defaultReleaseVersion = "255.255.255";

delombok.dependsOn('compileJava')
jar.dependsOn('copyNativeLib')
javadoc.dependsOn('copyNativeLib')
copyNativeLib.dependsOn('buildRustRelease')
compileTestJava.dependsOn('copyNativeLib')
test.dependsOn('buildRust')
Expand All @@ -183,8 +189,7 @@ publishing {
from components.java
groupId = 'io.valkey'
artifactId = 'valkey-glide'
// version is replaced during released workflow java-cd.yml
version = "255.255.255"
version = System.getenv("GLIDE_RELEASE_VERSION") ?: defaultReleaseVersion;
pom {
name = 'valkey-glide'
description = 'General Language Independent Driver for the Enterprise (GLIDE) for Valkey'
Expand Down Expand Up @@ -217,8 +222,15 @@ publishing {
}

java {
modularity.inferModulePath = true
withSourcesJar()
// withJavadocJar()
withJavadocJar()
}

tasks.withType(Sign) {
def releaseVersion = System.getenv("GLIDE_RELEASE_VERSION") ?: defaultReleaseVersion;
def isReleaseVersion = !releaseVersion.endsWith("SNAPSHOT") && releaseVersion != defaultReleaseVersion;
onlyIf("isReleaseVersion is set") { isReleaseVersion }
}

signing {
Expand All @@ -236,9 +248,7 @@ tasks.withType(Test) {
}

jar {
archiveBaseName = "valkey-glide"
// placeholder will be renamed by platform+arch on the release workflow java-cd.yml
archiveClassifier = "placeholder"
archiveClassifier = osdetector.classifier
}

sourcesJar {
Expand All @@ -247,6 +257,17 @@ sourcesJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

delombok {
modulePath = classpath
}

javadoc {
dependsOn delombok
source = delombok.outputs
options.tags = [ "example:a:Example:" ]
failOnError = false // TODO fix all javadoc errors and warnings and remove that
}

spotbugsMain {
reports {
html {
Expand Down
3 changes: 2 additions & 1 deletion java/examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ repositories {
}

dependencies {
implementation project(':client')
implementation "io.valkey:valkey-glide:1.0.1:${osdetector.classifier}"

implementation 'redis.clients:jedis:4.4.3'
implementation 'io.lettuce:lettuce-core:6.2.6.RELEASE'
implementation 'commons-cli:commons-cli:1.5.0'
Expand Down
Loading