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
103 changes: 103 additions & 0 deletions .github/workflows/java-cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Java CI/CD

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
# needs: build-and-test
# if: github.event_name == 'workflow_dispatch'
env:
JRELEASER_GPG_SECRET_KEY: ${{ secrets.SONATYPE_MAVEN_SIGNING_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SONATYPE_MAVEN_SIGNING_KEY_PASSWORD }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_USERNAME }}
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_PASSWORD }}
defaults:
run:
working-directory: clients/java

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Make gradlew executable
run: chmod +x gradlew

- name: Publish
run: ./gradlew clean publish

- name: Check required secrets
run: |
if [[ -z "$JRELEASER_GPG_SECRET_KEY" ]]; then
echo "❌ JRELEASER_GPG_SECRET_KEY is not set"
exit 1
fi
if [[ -z "$JRELEASER_GPG_PASSPHRASE" ]]; then
echo "❌ JRELEASER_GPG_PASSPHRASE is not set"
exit 1
fi
if [[ -z "$JRELEASER_MAVENCENTRAL_USERNAME" ]]; then
echo "❌ JRELEASER_MAVENCENTRAL_USERNAME is not set"
exit 1
fi
if [[ -z "$JRELEASER_MAVENCENTRAL_TOKEN" ]]; then
echo "❌ JRELEASER_MAVENCENTRAL_TOKEN is not set"
exit 1
fi
echo "✅ All required secrets are set"

- name: Deploy to Sonatype
run: ./gradlew jreleaserDeploy
# GRADLE_OPTS: >-
# -DsonatypeUsername=${{ secrets.SONATYPE_MAVEN_USERNAME }}
# -DsonatypePassword=${{ secrets.SONATYPE_MAVEN_PASSWORD }}
# -DsigningKey=${{ secrets.SONATYPE_MAVEN_SIGNING_KEY }}
# -DsigningPassword=${{ secrets.SONATYPE_MAVEN_SIGNING_KEY_PASSWORD }}

# build-and-test:
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: clients/java

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: '17'
# distribution: 'temurin'

# - name: Make gradlew executable
# run: chmod +x gradlew

# - name: Run Gradle assemble
# run: ./gradlew assemble

# ## This requires more setup. Specifically, we need the server to be up w/
# ## some dummy data.
# # - name: Run tests
# # run: ./gradlew test

# - name: Upload build artifacts
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: build-reports
# path: |
# build/reports/
# build/test-results/
# retention-days: 7
22 changes: 4 additions & 18 deletions clients/java/bindings/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import java.net.URL

plugins {
`maven-publish`
`java-library`
`java-library-conventions`
`publishing-conventions`
kotlin("jvm") version "1.9.10"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
extra["displayName"] = "Superposition Foreign Function Interface"
description = "Bindings for some of superpositions core functions."

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("net.java.dev.jna:jna:5.13.0")
}


publishing {
publications {
create<MavenPublication>("maven") {
from(components["kotlin"])
}
}
}
57 changes: 48 additions & 9 deletions clients/java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import org.jreleaser.model.Active

plugins {
id("org.jreleaser") version "1.19.0"
id("base")
}

allprojects {
group = "io.juspay.superposition"
version = System.getenv("VERSION") ?: "0.0.1-SNAPSHOT"
Expand All @@ -6,17 +13,49 @@ allprojects {
google()
gradlePluginPortal()
}
}

/*
* Jreleaser (https://jreleaser.org) config.
*/
jreleaser {
dryrun = false

apply(plugin = "maven-publish")
// Used for creating a tagged release, uploading files and generating changelog.
// In the future we can set this up to push release tags to GitHub, but for now it's
// set up to do nothing.
// https://jreleaser.org/guide/latest/reference/release/index.html
release {
generic {
enabled = true
skipRelease = true
}
}

// Used to announce a release to configured announcers.
// https://jreleaser.org/guide/latest/reference/announce/index.html
announce {
active = Active.NEVER
}

// Signing configuration.
// https://jreleaser.org/guide/latest/reference/signing.html
signing {
active = Active.ALWAYS
armored = true
verify = false
}

configure<PublishingExtension> {
repositories {
maven {
name = "CodeArtifact"
url = uri(System.getenv("CODEARTIFACT_REPOSITORY_ENDPOINT") ?: "https://non.existent.site.here")
credentials {
username = "aws"
password = System.getenv("CODEARTIFACT_AUTH_TOKEN")
// Configuration for deploying to Maven Central.
// https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
deploy {
maven {
mavenCentral {
create("maven-central") {
active = Active.ALWAYS
url = "https://central.sonatype.com/api/v1/publisher"
snapshotSupported = true
stagingRepository(rootProject.layout.buildDirectory.dir("staging-deploy").get().asFile.path)
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions clients/java/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
mavenCentral()
google()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
`java-library`
}

java {
// Can't use this as provider is a mixed project.
// withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.provideDelegate

plugins {
`maven-publish`
signing
}

publishing {
// Add license spec to all maven publications
publications {
afterEvaluate {
create<MavenPublication>("maven") {
from(components["java"])
val displayName: String by extra
pom {
name.set(displayName)
description.set(project.description)
url.set("https://github.com/juspay/superposition")
licenses {
license {
name.set("Apache License 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("superposition")
name.set("superposition")
email.set("superposition@juspay.in")
organization.set("Juspay")
organizationUrl.set("https://juspay.io")
roles.add("developer")
}
}
scm {
connection.set("https://github.com/juspay/superposition.git")
developerConnection.set("https://github.com/juspay/superposition.git")
url.set("https://github.com/juspay/superposition.git")
}
}
}
}
}
repositories {
maven {
url = uri(layout.buildDirectory.dir("staging-deploy"))
}
}
}

signing {
setRequired {
// signing is required only if the artifacts are to be published to a maven repository
gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}

// Don't sign the artifacts if we didn't get a key and password to use.
if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) {
signing {
useInMemoryPgpKeys(
project.properties["signingKey"].toString(),
project.properties["signingPassword"].toString())
sign(publishing.publications["maven"])
}
}
}
26 changes: 5 additions & 21 deletions clients/java/open-feature-provider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
plugins {
`java-library`
`maven-publish`
`java-library-conventions`
`publishing-conventions`
kotlin("jvm") version "1.9.10"
id("io.freefair.lombok") version "8.6"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

kotlin {
jvmToolchain(17)
}
group = "${rootProject.group}.openfeature"
extra["displayName"] = "Superposition Openfeature Provider"
description = "Openfeature provider implementation for Superposition."

dependencies {
implementation(project(":bindings"))
Expand Down Expand Up @@ -43,13 +37,3 @@ tasks.test {
showStandardStreams = true
}
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "${rootProject.group}.openfeature"
artifactId = "superposition-provider"
from(components["java"])
}
}
}
19 changes: 4 additions & 15 deletions clients/java/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
plugins {
`java-library`
`maven-publish`
`java-library-conventions`
`publishing-conventions`
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
extra["displayName"] = "Superposition SDK"
description = "Java SDK for Superposition."

dependencies {
implementation("software.amazon.smithy.java:client-core:0.0.1")
implementation("software.amazon.smithy:smithy-aws-traits:1.55.0")
implementation("software.amazon.smithy.java:aws-client-restjson:0.0.1")
}

publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
Loading
Loading