Skip to content
Open
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
57 changes: 57 additions & 0 deletions .github/actions/setup-java/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0

---

name: Setup Java Environment
description: setup environment to build/test/lint Kotlin applications
inputs:
java-version:
description: 'Java version to install'
required: false
default: '21'
distribution:
description: 'Java distribution to use'
required: false
default: 'temurin'
cache-enabled:
description: 'Enable Gradle caching'
required: false
default: 'true'
outputs:
cache-hit:
description: "Whether we hit the cache"
value: ${{ steps.gradle-cache.outputs.cache-hit }}
runs:
using: "composite"
steps:
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.distribution }}
java-version: ${{ inputs.java-version }}
cache: false

- name: Setup Taskfile
uses: ./.github/actions/setup-task
with:
version: latest
cache-enabled: true

- name: Cache Gradle
if: ${{ inputs.cache-enabled == 'true' }}
id: gradle-cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}

- id: set-cache-hit
run: echo "cache-hit=${{ steps.gradle-cache.outputs.cache-hit }}" >> $GITHUB_OUTPUT
shell: bash

- name: Update GITHUB_PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
68 changes: 68 additions & 0 deletions .github/workflows/reusable-bindings-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,74 @@ jobs:
./data-plane/bindings/go/generated/**/*.h
if-no-files-found: error

kotlin-bindings-build-and-test:
runs-on: ${{ inputs.runner }}
needs:
- generate-matrix
- build-libraries

defaults:
run:
shell: bash
working-directory: ./data-plane/bindings/kotlin

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

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
workspace: ${{ inputs.rust-workspace }}

- name: Setup Java
uses: ./.github/actions/setup-java

# Download all library artifacts
- name: Download libraries
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: bindings-*
path: ./data-plane/bindings/kotlin/artifacts/

- name: List downloaded artifacts
run: |
echo "📦 Downloaded artifacts:"
find ./artifacts -type f -ls

- name: Generate Kotlin bindings
run: |
task generate LIB_PATH=./artifacts/lib${{ env.LIBRARY_NAME }}_x86_64_linux_gnu.so

echo "📁 Generated files:"
find ./generated -type f

- name: Make sure generation did not modify source files
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "❌ Generated Kotlin bindings differ from committed files. Please commit the updated bindings."
git status
git --no-pager diff
exit 1
else
echo "✅ Generated Kotlin bindings are up-to-date with committed files."
fi

- name: Run Kotlin bindings tests
run: |
echo "Running Kotlin bindings tests..."
task test

- name: Upload Generated Kotlin code
uses: actions/upload-artifact@v4
with:
name: kotlin-bindings-generated-code
path: |
./data-plane/bindings/kotlin/generated/**/*.kt
./data-plane/bindings/kotlin/generated/jniLibs/**/*
if-no-files-found: error

python-bindings-test:
name: Test Python Wheels (${{ matrix.platform.target }})
runs-on: ${{ matrix.platform.runner }}
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/reusable-kotlin-build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0

---
name: kotlin-build-and-test
on:
workflow_call:
inputs:
runner:
description: Github hosted runner or Self hosted runner
required: false
type: string
default: ubuntu-latest
continue-on-error:
description: Whether to skip the status update for this job
required: false
type: boolean
default: false
java-version:
description: Java version to use
required: false
type: string
default: '21'
kotlin-test:
description: Whether to run "task test"
required: false
type: boolean
default: true
upload-artifacts:
description: Whether to upload build artifacts
required: false
type: boolean
default: false
working-directory:
description: The working directory to run the task
required: false
type: string
default: ./data-plane/bindings/kotlin

jobs:
setup-environment:
runs-on: ${{ inputs.runner }}

defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}

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

- name: Setup Java
id: setup-java
uses: ./.github/actions/setup-java
with:
java-version: ${{ inputs.java-version }}

- name: Verify Java and Gradle versions
run: |
which java
java -version
./gradlew --version

test:
runs-on: ${{ inputs.runner }}

defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}

if: ${{ inputs.kotlin-test }}

needs: [setup-environment]

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

- name: Setup Java
uses: ./.github/actions/setup-java
with:
java-version: ${{ inputs.java-version }}

- name: Cache Gradle Build
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ inputs.working-directory }}/build
key: kotlin-test-${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}

- name: Run Kotlin Tests
run: |
which java
java -version

task test

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: kotlin-test-results
path: ${{ inputs.working-directory }}/build/reports/tests/test/
if-no-files-found: ignore
retention-days: 7

upload-artifacts:
runs-on: ${{ inputs.runner }}

defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}

if: ${{ inputs.upload-artifacts }}

needs: [setup-environment, test]

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

- name: Upload Generated Kotlin code
uses: actions/upload-artifact@v4
with:
name: kotlin-bindings-generated-code
path: |
${{ inputs.working-directory }}/generated/**/*.kt
${{ inputs.working-directory }}/generated/jniLibs/**/*
if-no-files-found: error
62 changes: 62 additions & 0 deletions data-plane/bindings/kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0

# Gradle
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties

# Kotlin
*.class
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
*.iml
*.ipr
*.iws

# IntelliJ IDEA
.idea/
out/
*.iml

# Eclipse
.classpath
.project
.settings/
bin/

# NetBeans
nbproject/
build/
nbbuild/
dist/
nbdist/

# VS Code
.vscode/

# macOS
.DS_Store

# UniFFI generated code
generated/

# Native libraries
*.so
*.dylib
*.dll
*.a
*.lib

# Logs
*.log

# Test results
test-results/
test-reports/
Loading
Loading