rearranging ffi mods, adding wasm and python builds

This commit is contained in:
Andy Pack 2025-02-15 20:27:44 +00:00
parent a567bcffaf
commit 37f4d8f84c
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
9 changed files with 54 additions and 10 deletions

@ -72,10 +72,53 @@ jobs:
command: publish
args: --package finlib
buildWASM:
name: Build WASM
runs-on: ubuntu-latest
needs: [ build ] # for ignoring bad builds
steps:
- name: Checkout
uses: actions/checkout@v4
with:
github-server-url: https://gitea.sheep-ghoul.ts.net
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Rust for WASM
working-directory: ./finlib-wasm
run: wasm-pack build
buildPy:
name: Build Python
runs-on: ubuntu-latest
needs: [ build ] # for ignoring bad builds
steps:
- uses: actions/checkout@v4 # get source
with:
github-server-url: https://gitea.sheep-ghoul.ts.net
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
- name: Install Maturin
run: pip3 install maturin
- name: Build Python
working-directory: ./pyfinlib
run: maturin develop
publishNPM:
name: Publish NPM
runs-on: ubuntu-latest
needs: [ build ] # for ignoring bad builds
needs: [ buildWASM ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout

8
Cargo.lock generated

@ -259,7 +259,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "finlib"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"getrandom 0.2.15",
"log",
@ -274,7 +274,7 @@ dependencies = [
[[package]]
name = "finlib-ffi"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"cbindgen",
"csbindgen",
@ -283,7 +283,7 @@ dependencies = [
[[package]]
name = "finlib-wasm"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"console_error_panic_hook",
"console_log",
@ -606,7 +606,7 @@ dependencies = [
[[package]]
name = "pyfinlib"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"finlib",
"pyo3",

@ -14,7 +14,7 @@ default-members = [
]
[workspace.package]
version = "0.0.1"
version = "0.0.2"
authors = ["sarsoo <andy@sarsoo.xyz>"]
description = "Quant finance functions implemented in Rust"
edition = "2021"

4
finlib/src/ffi/mod.rs Normal file

@ -0,0 +1,4 @@
#[cfg(feature = "py")]
pub mod py;
#[cfg(feature = "wasm")]
pub mod wasm;

@ -2,7 +2,4 @@ pub mod interest;
pub mod stats;
pub mod util;
pub mod risk;
#[cfg(feature = "py")]
pub mod py;
#[cfg(feature = "wasm")]
pub mod wasm;
pub mod ffi;