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 Aug 12, 2024
1 parent af88aae commit e8635b6
Show file tree
Hide file tree
Showing 39 changed files with 1,611 additions and 231 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ jobs:
variant:
- flake: ddnnife
artifact: ''
- flake: bundled-d4
- flake: ddnnife-d4-bundled
artifact: '-d4'
exclude:
- target: { double: x86_64-linux }
variant: { flake: ddnnife }
include:
- target: { double: x86_64-linux, runner: ubuntu-latest }
variant: { flake: ddnnife-static, artifact: '' }
docs: true
- target: { double: x86_64-windows, runner: ubuntu-latest }
variant: { flake: ddnnife-windows, artifact: '' }
- target: { double: x86_64-windows, runner: ubuntu-latest }
variant: { flake: bundled-d4-windows, artifact: '-d4' }
variant: { flake: ddnnife-windows-d4-bundled, artifact: '-d4' }
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
Expand All @@ -48,7 +54,7 @@ jobs:
- name: Build
run: nix build -L .#${{ matrix.variant.flake }}
- name: Set interpreter
if: ${{ matrix.target.double == 'x86_64-linux' && matrix.variant.flake == 'bundled-d4' }}
if: ${{ matrix.target.double == 'x86_64-linux' && matrix.variant.flake == 'ddnnife-d4-bundled' }}
run: |
cp -rL result output
rm -rf result
Expand All @@ -61,3 +67,19 @@ jobs:
with:
name: ddnnife-${{ matrix.target.double }}${{ matrix.variant.artifact }}
path: result
- name: Docs
if: ${{ matrix.target.docs }}
run: |
nix build .#documentation
mkdir docs
cp -rL result/share/doc docs/rust
- name: Upload (docs)
if: ${{ matrix.target.docs }}
uses: actions/upload-artifact@v4
with:
name: pages-rust
path: docs
Pages:
if: github.ref == 'refs/heads/main'
needs: Build
uses: ./.github/workflows/Pages.yaml
74 changes: 74 additions & 0 deletions .github/workflows/Kotlin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Kotlin

on:
- push

jobs:
Build:
strategy:
fail-fast: false
matrix:
target:
- double: x86_64-linux
jna: linux-x86-64
runner: ubuntu-24.04
docs: true
- double: x86_64-darwin
jna: darwin-x86-64
runner: macos-13
- double: aarch64-darwin
jna: darwin-aarch64
runner: macos-latest
variant:
- ''
- '-d4'
exclude:
- target: { double: x86_64-darwin }
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 }}
mkdir -p libraries/${{ matrix.target.jna }}
cp -L result/lib/*ddnnife* libraries/${{ matrix.target.jna }}/
- name: Build
run: |
cd bindings/kotlin
gradle shadowJar --no-daemon -Plibraries=../../libraries -Pbindgen=../../uniffi-bindgen
- name: Test
run: |
cd bindings/kotlin
gradle test --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: |
cd bindings/kotlin
gradle dokkaHtml --no-daemon -Plibraries=../../libraries -Pbindgen=../../uniffi-bindgen
mkdir docs
mv build/dokka/html docs/kotlin
- name: Upload (docs)
if: ${{ matrix.target.docs && matrix.variant == '' }}
uses: actions/upload-artifact@v4
with:
name: pages-kotlin
path: bindings/kotlin/docs
Pages:
if: github.ref == 'refs/heads/main'
needs: Build
uses: ./.github/workflows/Pages.yaml
23 changes: 23 additions & 0 deletions .github/workflows/Pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pages

on: workflow_call

jobs:
Deploy:
permissions:
pages: write
id-token: write
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/kotlin/de/softvare/ddnnife/ddnnife.kt
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 e8635b6

Please sign in to comment.