feat: deno ffi bindings (#40)

* initial ts commit
* monero.ts improvements
* test on latest, build on debian:bookworm
* feat: upstream changes to bindings
* chore: update checksums
* feat: allow manually loading dylib
* chore: add readme
* fix: free strings after being read to prevent potential memory leaks
* fix: load dylib
* fix: checksum checks segfaulting because of freeing const variables

---------

Co-authored-by: Mateusz Franik <47059999+Im-Beast@users.noreply.github.com>
Co-authored-by: Im-Beast <franik.mateusz@gmail.com>
This commit is contained in:
cyan
2024-09-19 10:59:07 +02:00
committed by GitHub
parent 0b91e91d19
commit d194094494
17 changed files with 1406 additions and 3 deletions

View File

@@ -137,7 +137,7 @@ jobs:
coin: [monero, wownero]
runs-on: ubuntu-latest
container:
image: debian:bookworm
image: debian:bullseye
steps:
- name: Install dependencies
run: |
@@ -698,6 +698,123 @@ jobs:
with:
name: ${{ matrix.coin }} xmruw apk
path: unnamed_monero_wallet/build/app/outputs/flutter-apk/*.apk
bulk_lib_release:
name: create single release file
runs-on: ubuntu-latest
needs: [
lib_mingw, lib_android, lib_linux, lib_sailfishos_aarch64, lib_sailfishos_i486, lib_darwin, lib_macos, lib_ios
]
steps:
- uses: actions/download-artifact@v4
with:
name: android monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: android wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: darwin monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: darwin wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: ios monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: ios wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: linux monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: linux wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: macos monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: macos wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: mingw monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: mingw wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: sfos aarch64 monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: sfos aarch64 wownero
path: release/wownero
- uses: actions/download-artifact@v4
with:
name: sfos_i486 monero
path: release/monero
- uses: actions/download-artifact@v4
with:
name: sfos_i486 wownero
path: release/wownero
- name: zip release dir
run: zip -r release-bundle.zip release
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: release-bundle.zip
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
- name: Upload lib
uses: actions/upload-artifact@v4
with:
name: release-bulk
path: release
deno_monerots_test_linux:
name: test ts library
runs-on: ubuntu-24.04
needs: [
lib_linux
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: linux monero
path: release/monero
- name: unpack and move monero_c
run: |
unxz -f -k release/*/*.xz
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: Create symlink
run: |
cd impls/monero.ts
mkdir lib
cd lib
ln -s ../../../release/monero/x86_64-linux-gnu_libwallet2_api_c.so
mv x86_64-linux-gnu_libwallet2_api_c.so monero_libwallet2_api_c.so
cd ..
- name: Run tests
run: |
cd impls/monero.ts
deno run --unstable-ffi --allow-ffi checksum.ts
comment_pr:
name: comment on pr
@@ -752,4 +869,4 @@ jobs:
with:
issue-number: ${{steps.get_issue_number.outputs.result}}
body: |
[download artifacts #${{github.run_id}}](https://nightly.link/MrCyjaneK/monero_c/actions/runs/${{github.run_id}}) (this comment will update whenever you push)
[download artifacts #${{github.run_id}}](https://nightly.link/MrCyjaneK/monero_c/actions/runs/${{github.run_id}}) (this comment will update whenever you push)