publishing rust lib

This commit is contained in:
Andy Pack 2025-02-15 01:05:20 +00:00
parent 1cefa6f756
commit c1113f3296
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
11 changed files with 8291 additions and 1 deletions

@ -30,6 +30,48 @@ jobs:
with:
command: test
publishRustLib:
runs-on: ubuntu-latest
name: Publish Rust Library
needs: [ build ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
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: Add SarGit Repo
run: |
cat <<EOF > ~/.cargo/config.toml
[registry]
default = "sargit"
[registries.sargit]
index = "sparse+https://git.sarsoo.xyz/api/packages/${{ secrets.DOCKERHUB_USERNAME }}/cargo/"
[net]
git-fetch-with-cli = true
EOF
- name: Add SarGit Credentials
run: |
cat <<EOF > ~/.cargo/credentials.toml
[registries.sargit]
token = "Bearer ${{ secrets.DOCKERHUB_TOKEN }}"
EOF
- name: Cargo Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --package finlib
publishNPM:
name: Publish NPM
runs-on: ubuntu-latest

1
.gitignore vendored

@ -5,3 +5,4 @@ obj
.idea
/finlib-wasm/pkg
/FinLib.NET/FinLib.sln.DotSettings.user
node_modules

@ -16,7 +16,12 @@ default-members = [
[workspace.package]
version = "0.0.1"
authors = ["sarsoo <andy@sarsoo.xyz>"]
description = "Quant finance functions implemented in Rust"
edition = "2021"
homepage = "https://git.sarsoo.xyz/sarsoo/finlib"
repository = "https://git.sarsoo.xyz/sarsoo/finlib"
documentation = "https://sarsoo.github.io/finlib"
readme = "README.md"
[workspace.dependencies]
rayon = "1.10.0"

@ -3,6 +3,11 @@ name = "finlib-ffi"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
[lib]
crate-type = ["cdylib"]

@ -3,6 +3,11 @@ name = "finlib-wasm"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
[lib]
crate-type = ["cdylib", "rlib"]

4107
finlib-wasm/js-local/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
import { ValueAtRisk } from "finlib";
import { ValueAtRisk } from "@sarsoo/finlib";
console.log(ValueAtRisk.varcovar([1, 2, 3, 4], 0.1));
console.log(ValueAtRisk.varcovar([1, 2, 3, 4], 0.05));

4104
finlib-wasm/js-repo/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

@ -33,3 +33,13 @@ impl Stats {
finlib::stats::covariance(&slice, &slice_two)
}
}
#[wasm_bindgen]
pub struct Util { }
#[wasm_bindgen]
impl Util {
pub fn rates_of_change(slice: Vec<f64>) -> Vec<f64> {
finlib::util::roc::rates_of_change(&slice).collect::<Vec<_>>()
}
}

@ -1,8 +1,14 @@
[package]
name = "finlib"
publish = ["sargit"]
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
[dependencies]
pyo3 = { workspace = true, optional = true }

@ -3,6 +3,11 @@ name = "pyfinlib"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
documentation.workspace = true
readme.workspace = true
[lib]
# The name of the native library. This is the name which will be used in Python to import the