Skip to content

Commit

Permalink
feat(ffi): initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed Jul 16, 2024
1 parent af88aae commit b781680
Show file tree
Hide file tree
Showing 30 changed files with 1,089 additions and 47 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/Kotlin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Kotlin

on:
- push

jobs:
Build:
strategy:
fail-fast: false
matrix:
target:
- double: x86_64-linux
jna: linux-x86-64
runner: ubuntu-latest
docs: true
- double: x86_64-darwin
jna: darwin-x86-64
runner: macos-13
- double: aarch64-darwin
jna: darwin-aarch64
runner: macos-latest
variant:
- ''
- '-d4'
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build (bindgen)
run: |
nix build -L .#bindgen
cp -L result/bin/uniffi-bindgen .
- name: Build (library)
run: |
nix build -L .#libddnnife${{ matrix.variant }}
cp -rL result libraries
chmod -R 755 libraries
mv libraries/lib libraries/${{ matrix.target.jna }}
- name: Build
run: |
cd bindings/kotlin
nix run nixpkgs#gradle -- build --no-daemon -Plibraries=../../libraries -Pbindgen=../../uniffi-bindgen
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ddnnife-kotlin-${{ matrix.target.double }}${{ matrix.variant }}
path: bindings/kotlin/build/libs
- name: Docs
if: ${{ matrix.target.docs && matrix.variant == '' }}
run: |
nix run nixpkgs#gradle -- dokkaHtml
mkdir docs
mv build/dokka/html docs/kotlin
- name: Upload
if: ${{ matrix.target.docs && matrix.variant == '' }}
uses: actions/upload-artifact@v4
with:
name: pages-kotlin
path: bindings/kotlin/docs
Deploy:
needs: Build
uses: ./.github/workflows/Pages.yaml
21 changes: 21 additions & 0 deletions .github/workflows/Pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pages

on:
workflow_call:

jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: Download
uses: actions/download-artifact@v4
with:
path: pages
pattern: pages-*
merge-multiple: true
- name: Upload
uses: actions/upload-pages-artifact@v3
with:
path: pages
- name: Deploy
uses: actions/deploy-pages@v4
32 changes: 32 additions & 0 deletions .github/workflows/Python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python

on:
- push

jobs:
Build:
strategy:
fail-fast: false
matrix:
target:
- double: x86_64-linux
runner: ubuntu-latest
- double: x86_64-darwin
runner: macos-13
- double: aarch64-darwin
runner: macos-latest
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build
run: nix build -L .#python
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ddnnife-python-${{ matrix.target.double }}
path: result
34 changes: 21 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# These are backup files generated by rustfmt
# Rust
/target
**/*.rs.bk

# Local files for testing, debugging and analysing the code
Expand Down Expand Up @@ -33,14 +30,25 @@ valcom
*-mermaid.md
*.svg

# vsc
.idea
.vscode/
# Nix
result

# Kotlin
bindings/kotlin/src/main
bindings/kotlin/.gradle
bindings/kotlin/gradle
bindings/kotlin/gradlew
bindings/kotlin/gradlew.bat
bindings/kotlin/build

# intellij
ideas/
# Python
.venv
__pycache__

# IDEs
.idea
*.iml
.vscode

# d4 repo and binary
d4v2
d4v2.bin
# macOS
.DS_Store
Loading

0 comments on commit b781680

Please sign in to comment.