Skip to content
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
41 changes: 41 additions & 0 deletions .github/workflows/ci_check_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: CI Checks on PRs

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -138,3 +141,41 @@ jobs:
make test CI=1
env:
APP_ENV: "TEST"

java-build:
name: Java build
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
74 changes: 25 additions & 49 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,29 +289,25 @@ jobs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.tag-release.outputs.version }}
AWS_REGION: ${{ vars.AWS_REGION }}
CODEARTIFACT_DOMAIN: ${{ vars.CODEARTIFACT_DOMAIN }}
CODEARTIFACT_REPOSITORY: ${{ vars.CODEARTIFACT_REPOSITORY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.SONATYPE_MAVEN_SIGNING_KEY }}
JRELEASER_GPG_PUBLIC_KEY: ${{ vars.SONATYPE_MAVEN_SIGNING_PUB_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SONATYPE_MAVEN_SIGNING_KEY_PASSWORD }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_USERNAME }}
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_PASSWORD }}
VERSION: ${{ needs.tag-release.outputs.version }}
defaults:
run:
working-directory: clients/java

steps:
- name: Checkout repository
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.1.0
with:
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}
role-session-name: superposition-release
role-to-assume: ${{ secrets.AWS_ARTIFACT_ROLE }}

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

- name: Download all rust binary artifacts
uses: actions/download-artifact@v4
Expand All @@ -327,7 +323,7 @@ jobs:

- name: Extract and organize native libraries
run: |
mkdir -p clients/java/bindings/src/main/resources
mkdir -p bindings/src/main/resources
mkdir temp_extract
# Extract all native libraries
for zip_file in rust-binaries/*.zip; do
Expand Down Expand Up @@ -364,7 +360,7 @@ jobs:
esac

# Create the platform-specific directory
target_dir="clients/java/bindings/src/main/resources/$platform"
target_dir="bindings/src/main/resources/$platform"
mkdir -p "$target_dir"

# Copy the file
Expand All @@ -378,36 +374,16 @@ jobs:

# List what we have
echo "Native libraries in bindings package:"
ls -lar clients/java/bindings/src/main/resources/
ls -lar bindings/src/main/resources/

- name: Configure CodeArtifact for Gradle
run: |
# Get CodeArtifact authorization token
export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain $CODEARTIFACT_DOMAIN \
--query authorizationToken --output text)
- name: Make gradlew executable
run: chmod +x gradlew

# Get repository endpoint
export CODEARTIFACT_REPOSITORY_ENDPOINT=$(aws codeartifact get-repository-endpoint \
--domain $CODEARTIFACT_DOMAIN \
--repository $CODEARTIFACT_REPOSITORY \
--format maven --query repositoryEndpoint --output text)
- name: Publish
run: ./gradlew clean publish

echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $GITHUB_ENV
echo "CODEARTIFACT_REPOSITORY_ENDPOINT=$CODEARTIFACT_REPOSITORY_ENDPOINT" >> $GITHUB_ENV

- name: Build Java packages
run: |
cd clients/java
./gradlew build -x test

- name: Publish Java packages
run: |
cd clients/java
./gradlew publish
env:
CODEARTIFACT_AUTH_TOKEN: ${{ env.CODEARTIFACT_AUTH_TOKEN }}
CODEARTIFACT_REPOSITORY_ENDPOINT: ${{ env.CODEARTIFACT_REPOSITORY_ENDPOINT }}
- name: Deploy to Sonatype
run: ./gradlew jreleaserDeploy --info --stacktrace

generate-python-packages:
needs: [tag-release, generate-rust-binary]
Expand Down Expand Up @@ -609,7 +585,7 @@ jobs:
toolchain: 1.86.0
targets: wasm32-unknown-unknown
components: rustfmt, clippy, cargo

- name: install cargo-edit to perform set-version
uses: baptiste0928/cargo-install@v2.2.0
with:
Expand All @@ -632,7 +608,7 @@ jobs:
cargo publish --package superposition_types
cargo publish --package superposition_core
cargo publish --package superposition_provider

release:
needs: [tag-release, generate-rust-binary]
runs-on: ubuntu-latest
Expand Down
21 changes: 7 additions & 14 deletions clients/java/bindings/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
import java.net.URL

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

java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion.set(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"])
}
}
}
68 changes: 59 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,60 @@ allprojects {
google()
gradlePluginPortal()
}
}

configurations.all {
resolutionStrategy {
force(
"com.fasterxml.jackson.core:jackson-core:2.16.0",
"com.fasterxml.jackson:jackson-bom:2.16.0",
"com.fasterxml.jackson.core:jackson-databind:2.16.0",
"com.fasterxml.jackson.core:jackson-annotations:2.16.0"
)
}
}

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

// 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
}
}

apply(plugin = "maven-publish")
// 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("m2").get().asFile.path)
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions clients/java/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
mavenCentral()
google()
}

dependencies {
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.9.10")
implementation("org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin:2.0.0")
constraints {
// org.owasp.dependencycheck needs at least this version of jackson. Other plugins pull in older versions..
add("implementation", "com.fasterxml.jackson:jackson-bom:2.16.1")

// org.owasp.dependencycheck needs these versions. Other plugins pull in older versions..
add("implementation", "org.apache.commons:commons-lang3:3.14.0")
add("implementation", "org.apache.commons:commons-text:1.11.0")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
kotlin("jvm")
id("org.jetbrains.dokka")
}

kotlin {
jvmToolchain(17)
}

tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
Loading
Loading