Skip to content

Commit

Permalink
Add java target (#153)
Browse files Browse the repository at this point in the history
* Adding Java target, working on complete tests

* All Kotlin tests reproduced

* Add Java release workflow

* Set up for a release across all versions

add release and CI steps for Java

* Cargo format and clippy

* Sort deps

* Add benchmarks

Standalone works, SaaS shield is failing to reach the local TSP
for me

* Update benchmark commands

* Fix nix flake on darwin

* Add links to benchmarks

* Add benches for java.

* Code review, make crates releasable

---------

Co-authored-by: Colt Frederickson <[email protected]>
  • Loading branch information
skeet70 and coltfred authored Aug 15, 2024
1 parent 0bda0fc commit a4a34f6
Show file tree
Hide file tree
Showing 39 changed files with 1,540 additions and 114 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/sdk-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python/Kotlin CI
name: Python/Kotlin/Java CI
on:
pull_request:
workflow_dispatch:
Expand Down Expand Up @@ -53,6 +53,44 @@ jobs:
- name: Run Kotlin tests
run: ./gradlew test
working-directory: kotlin

java-test:
needs: generate-cdylibs
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
# This should stay in sync with the `os_matrix` above
runs-on:
[
"buildjet-2vcpu-ubuntu-2004",
"buildjet-4vcpu-ubuntu-2204-arm",
"macos-12",
"macos-14",
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- uses: actions/download-artifact@v4
with:
name: ${{ join(matrix.runs-on) }}-
path: ${{ github.workspace }}/java/src/main/resources/
- if: startsWith(matrix.runs-on, 'buildjet')
uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- if: startsWith(matrix.runs-on, 'macos')
uses: Swatinem/rust-cache@v2
with:
cache-provider: github
- name: Generate Java files
run: cargo run --bin uniffi-bindgen-java generate --library resources/libironcore_alloy.* --out-dir java
working-directory: java/src/main
- name: Run Java tests
run: ./gradlew test
working-directory: java

python-test:
needs: generate-cdylibs
Expand Down
55 changes: 49 additions & 6 deletions .github/workflows/sdk-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python/Kotlin Release
name: Python/Kotlin/Java Release
on:
# https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
# The Bump Version workflow will make a Github release if it isn't a prerelease version
Expand All @@ -11,21 +11,21 @@ jobs:
generate-cdylibs:
uses: IronCoreLabs/workflows/.github/workflows/rust-artifact.yaml@rust-artifact-v0
with:
os_matrix: '["buildjet-2vcpu-ubuntu-2204", "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", "macos-14"]'
os_matrix: '["buildjet-2vcpu-ubuntu-2004", "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", "macos-14"]'
build_profile: "release"
secrets: inherit

kotlin-release:
needs: generate-cdylibs
runs-on: buildjet-2vcpu-ubuntu-2204
runs-on: buildjet-2vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/kotlin/src/main/resources/
- name: Rename directories
run: |
mv buildjet-2vcpu-ubuntu-2204- linux-x86-64
mv buildjet-2vcpu-ubuntu-2004- linux-x86-64
mv buildjet-4vcpu-ubuntu-2204-arm- linux-arm
mv macos-12- darwin-x86-64
mv macos-14- darwin-aarch64
Expand Down Expand Up @@ -54,17 +54,60 @@ jobs:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}

java-release:
needs: generate-cdylibs
runs-on: buildjet-2vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/java/src/main/resources/
- name: Rename directories
run: |
mv buildjet-2vcpu-ubuntu-2004- linux-x86-64
mv buildjet-4vcpu-ubuntu-2204-arm- linux-arm
mv macos-12- darwin-x86-64
mv macos-14- darwin-aarch64
working-directory: java/src/main/resources/
- name: Decrypt GPG key and gradle.properties
uses: IronCoreLabs/ironhide-actions/decrypt@v3
with:
keys: ${{ secrets.IRONHIDE_KEYS }}
input: .github/9FA43559.asc.iron .github/gradle.properties.iron
- name: Move gradle properties and GPG key
run: mv .github/gradle.properties java/gradle.properties
- name: Import GPG key
run: gpg --batch --import .github/9FA43559.asc
- name: Export GPG signing key
run: gpg --export-secret-keys > /tmp/9FA43559.asc
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- name: Generate Java files
run: cargo run --bin uniffi-bindgen-java generate --library resources/linux-x86-64/libironcore_alloy.so --out-dir java
working-directory: java/src/main
- name: Publish
run: ./gradlew publish
working-directory: java
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}

python-release:
needs: generate-cdylibs
runs-on: buildjet-2vcpu-ubuntu-2204
runs-on: buildjet-2vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/python/ironcore-alloy
- name: Rename directories
run: |
mv buildjet-2vcpu-ubuntu-2204- linux-x86-64
mv buildjet-2vcpu-ubuntu-2004- linux-x86-64
mv buildjet-4vcpu-ubuntu-2204-arm- linux-arm
mv macos-12- darwin-x86-64
mv macos-14- darwin-aarch64
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.11.0 (Unreleased)
## 0.11.1

Breaking changes:

Expand All @@ -9,6 +9,7 @@ Breaking changes:

Other changes:

- Added Java bindings, `ironcore-alloy-java`
- Added batch functionality to all SDK traits.
- Fixed a bug where Standard Attached wasn't accessible for SaaS Shield clients.
- Added rekey functionality for standard_attached data.
Expand Down
Loading

0 comments on commit a4a34f6

Please sign in to comment.