Skip to content

Merge pull request #340 from HapticX/dev #260

Merge pull request #340 from HapticX/dev

Merge pull request #340 from HapticX/dev #260

name: Language Bindings ✨
permissions:
contents: read
on:
push:
branches:
- 'master'
- 'dev'
paths:
- '**/language_bindings.yml'
- '**/bindings/**'
- '**/constants.nim'
jobs:
dependencies:
name: Install dependencies 🧩
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
nim_version:
- '2.0.8'
env:
TIMEOUT_EXIT_STATUS: 124
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.nimble
.nim_runtime
key: ${{ runner.os }}-nimble-v2-${{ hashFiles('*.nimble') }}
- uses: jiro4989/setup-nim-action@v2
with:
nim-version: ${{ matrix.nim_version }}
- name: Install Dependencies 🔃
run: |
nimble refresh
nimble install -y -d
nimble install checksums jnim nimpy -y
python:
name: Python bindings 🐍
runs-on: ${{ matrix.os }}
needs: dependencies
strategy:
matrix:
os:
- ubuntu-latest
python_version:
- '3.x'
env:
TIMEOUT_EXIT_STATUS: 124
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.nimble
.nim_runtime
key: ${{ runner.os }}-nimble-v2-${{ hashFiles('*.nimble') }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Python Dependencies 🐍
run: |
python -m pip install --upgrade pip
pip install -U twine build packaging
- name: Python Bindings 🐍
run: |
export PATH=$PATH:$PWD/.nim_runtime/bin
nimble install checksums jnim nimpy -y
sudo apt-get install gcc-aarch64-linux-gnu
cd src
echo "Windows module"
echo "Win Module compiled with"
echo "nim c --app:lib --out:../bindings/python/happyx/happyx.pyd -d:useRealtimeGC --mm:arc --tlsEmulation:off --passL:-static --t:-flto --l:-flto --opt:speed --threads:off -d:release -d:httpx -d:export2py happyx"
echo "Linux amd64"
nim c --app:lib --out:../bindings/python/happyx/happyx_unix_amd64.so -d:useRealtimeGC --mm:arc -t:-flto -l:-flto --opt:speed --threads:off -d:release -d:happyxDebug -x:off -a:off -d:beast -d:export2py happyx
echo "Linux arm64"
nim c --app:lib --cpu:arm64 --out:../bindings/python/happyx/happyx_unix_arm64.so -d:useRealtimeGC --mm:arc -t:-flto -l:-flto --opt:speed --threads:off -d:release -d:happyxDebug -x:off -a:off -d:beast -d:export2py happyx
shell: bash
- name: Build Python Package 🏗
run: |
cd bindings/python
python -m build
# TODO:
# account recovery
- name: Publish Python package 📢
if: github.ref == 'refs/heads/master'
uses: pypa/gh-action-pypi-publish@8cdc2ab67c943c5edf5fd9ae1995546b4b550602
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: bindings/python/dist/
verbose: true
jvm:
name: JVM Bindings ☕
runs-on: ${{ matrix.os }}
needs: dependencies
strategy:
matrix:
os:
- ubuntu-latest
java_version:
- '16'
gradle_version:
- '7.4.2'
env:
TIMEOUT_EXIT_STATUS: 124
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.nimble
.nim_runtime
key: ${{ runner.os }}-nimble-v2-${{ hashFiles('*.nimble') }}
- uses: gradle/gradle-build-action@v3
id: setup-gradle
with:
gradle-version: ${{ matrix.gradle_version }}
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
architecture: x64
cache: 'gradle'
- name: JVM Bindings ☕
run: |
export PATH=$PATH:$PWD/.nim_runtime/bin
nimble install checksums jnim nimpy -y
cd src
echo "Unix module"
nim c -d:noSignalHandler -d:export2jvm -d:release -d:httpx --app:lib --threads:on --opt:speed --mm:arc --out:../bindings/java/src/main/resources/happyx.so happyx.nim
cd ..
- name: Build Java Project ☕
run: |
cd bindings/java
gradle build --scan