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
69 changes: 69 additions & 0 deletions .github/workflows/build-kotlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build Kotlin/Android Bindings

on:
workflow_call:
inputs:
ref:
description: 'Git ref to check out and build'
required: true
type: string

jobs:
build:
name: Build Kotlin Multiplatform Bindings (macOS)
runs-on: macos-15
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21

- uses: dtolnay/rust-toolchain@stable
with:
targets: >-
x86_64-linux-android,
aarch64-linux-android,
armv7-linux-androideabi,
i686-linux-android,
aarch64-apple-ios,
aarch64-apple-ios-sim,
x86_64-apple-ios

- uses: Swatinem/rust-cache@v2
with:
shared-key: "greenlight-kotlin"

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Task
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

- name: Install cargo-ndk
run: cargo install cargo-ndk --version 3.5.4

- name: Build Kotlin Multiplatform bindings
run: task build:kotlin

- name: Build Android library
working-directory: libs/gl-sdk-android
run: ./gradlew :lib:assemble --console=plain

- name: Publish to Maven Local (validation)
working-directory: libs/gl-sdk-android
run: ./gradlew :lib:publishToMavenLocal --console=plain

- name: Upload Kotlin build outputs
uses: actions/upload-artifact@v7
with:
name: kotlin-outputs
path: libs/gl-sdk-android/lib/build/outputs/
retention-days: 7
93 changes: 93 additions & 0 deletions .github/workflows/build-napi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build N-API Bindings

on:
workflow_call:
inputs:
ref:
description: 'Git ref to check out and build'
required: true
type: string

jobs:
build:
name: Build N-API - ${{ matrix.host }} / ${{ matrix.target }}
runs-on: ${{ matrix.host }}
strategy:
fail-fast: false
matrix:
include:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
strip: strip -x *.node

- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
strip: aarch64-linux-gnu-strip -x *.node

- host: macos-14
target: aarch64-apple-darwin
strip: strip -x *.node

- host: windows-latest
target: x86_64-pc-windows-msvc
strip: ""

defaults:
run:
working-directory: libs/gl-sdk-napi

steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
cache-dependency-path: libs/gl-sdk-napi/package-lock.json

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
shared-key: "greenlight-${{ matrix.target }}"

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: '23.2'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup cross-compilation (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build -- --target ${{ matrix.target }}
shell: bash

- name: Strip binary
if: matrix.strip != ''
run: ${{ matrix.strip }}
shell: bash

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: napi-${{ matrix.target }}
path: |
libs/gl-sdk-napi/*.node
libs/gl-sdk-napi/index.js
libs/gl-sdk-napi/index.d.ts
if-no-files-found: error
retention-days: 7
148 changes: 148 additions & 0 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Build Python Wheels

on:
workflow_call:
inputs:
ref:
description: 'Git ref to check out and build'
required: true
type: string

jobs:
source:
name: Source Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

- name: Build source distribution
run: uv build --package gl-client --sdist

- name: Upload source distribution
uses: actions/upload-artifact@v7
with:
name: python-sdist
path: dist/gl_client-*.tar.gz
retention-days: 7

wheels:
name: Wheels - ${{ matrix.os }} / ${{ matrix.target }}
runs-on: ${{ matrix.host }}
strategy:
fail-fast: false
matrix:
include:
- host: ubuntu-latest
os: linux
target: x86_64
architecture: x64

- host: ubuntu-latest
os: linux
target: i686
architecture: x64

- host: macos-14
os: macos
target: aarch64
architecture: arm64

- host: windows-latest
os: windows
target: x64
architecture: x64

- host: windows-latest
os: windows
target: x86
architecture: x86

steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- uses: actions/setup-python@v6
with:
python-version: '3.10'
architecture: ${{ matrix.architecture }}

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache (Per Architecture)
uses: Swatinem/rust-cache@v2
with:
shared-key: "greenlight-${{ matrix.target || 'host' }}"

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: '23.2'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: libs/gl-client-py
rust-toolchain: stable
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist
# Mount host protoc into maturin's Docker container (Linux only)
docker-options: >-
-v /opt/hostedtoolcache/protoc/v23.2/x64/bin/protoc:/usr/bin/protoc:ro

- name: Build gl-sdk shared library (64-bit only)
if: matrix.target == 'x86_64' || matrix.target == 'aarch64' || matrix.target == 'x64'
run: cargo build --release -p gl-sdk

- name: Build and retag gl-sdk wheel (64-bit only)
if: matrix.target == 'x86_64' || matrix.target == 'aarch64' || matrix.target == 'x64'
shell: bash
run: |
if [ "${{ matrix.os }}" = "macos" ]; then
LIB_EXT="dylib"
elif [ "${{ matrix.os }}" = "windows" ]; then
LIB_EXT="dll"
else
LIB_EXT="so"
fi
mkdir -p libs/gl-sdk/glsdk
LIB_PATH=$(find target -name "libglsdk.${LIB_EXT}" -o -name "glsdk.${LIB_EXT}" | head -n 1)
install -m 0755 "${LIB_PATH}" libs/gl-sdk/glsdk/libglsdk.${LIB_EXT}
if [ "${{ matrix.os }}" = "linux" ] && [ -d "libs/gl-client-py/dist" ]; then
sudo chown -R $(id -u):$(id -g) libs/gl-client-py/dist
fi
uv build --package gl-sdk --wheel --out-dir libs/gl-client-py/dist
# Retag: hatchling produces py3-none-any but the wheel contains a native shared lib
pip install wheel
if [ "${{ matrix.os }}" = "linux" ]; then
PLAT="manylinux_2_17_${{ matrix.target }}"
elif [ "${{ matrix.os }}" = "macos" ]; then
PLAT="${{ matrix.target == 'aarch64' && 'macosx_11_0_arm64' || 'macosx_10_12_x86_64' }}"
elif [ "${{ matrix.os }}" = "windows" ]; then
PLAT="${{ matrix.target == 'x64' && 'win_amd64' || 'win32' }}"
fi
for whl in libs/gl-client-py/dist/gl_sdk*.whl; do
python -m wheel tags --remove --platform-tag "$PLAT" "$whl"
done

- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: python-wheel-${{ matrix.os }}-${{ matrix.target }}
path: libs/gl-client-py/dist/
retention-days: 7
36 changes: 36 additions & 0 deletions .github/workflows/build-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Test Rust

on:
workflow_call:
inputs:
ref:
description: 'Git ref to check out and build'
required: true
type: string

jobs:
build-and-test:
name: Rust build and unit tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
shared-key: "greenlight-rust"

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: '23.2'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build workspace
run: cargo build --workspace

- name: Run tests
run: cargo test --workspace
Loading
Loading