Skip to content

Commit

Permalink
Spike/ffi (#53)
Browse files Browse the repository at this point in the history
* Renamed drift-sdk -> drift-rs
Changes:
* Remove drift-program & jit-proxy deps use drift-ffi-sys crate & IDL generated structs
* Remove subscription Event Any/Box-ing
* Remove AccountProvider (have user maps now which will support switching between Ws/Poll/Rpc)
* Rework map classes to be more idiomatic
* Refactor client methods to fallback to network query
* Fetch multiple account with fallback methods on sync, allows better compatibility with more RPC providers/plans
* Add AccountMap for generic account subscriptions
Other:
* Add .rustfmt toml
* dlob behind feature flag
* release ci config
* Update README
  • Loading branch information
jordy25519 authored Sep 27, 2024
1 parent ca0884b commit 093f0ed
Show file tree
Hide file tree
Showing 62 changed files with 36,872 additions and 5,504 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,44 @@ on:
- "**.toml"
- "**.lock"
- ".github/workflows/*.yml"

jobs:
format-build-test:
runs-on: ubuntu-latest
runs-on: ubicloud
steps:
- name: Check out
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
components: rustfmt
default: true
- name: Config rust toolchain
run: |
rustup show active-toolchain
rustup component add clippy rustfmt
- name: install libdrift_ffi_sys
run: |
curl -L https://github.com/user-attachments/files/17160233/libdrift_ffi_sys.so.zip > ffi.zip
unzip ffi.zip
ldd libdrift_ffi_sys.so
sudo cp libdrift_ffi_sys.so /usr/lib
ldconfig -p
- name: Format
run: cargo fmt --all -- --check
- name: Build
run: cargo check --all-features
- name: Clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
github_token: ${{ secrets.GITHUB_TOKEN }}
run: cargo check
env:
CARGO_DRIFT_FFI_PATH: "/usr/lib"
# - name: Clippy
# uses: giraffate/clippy-action@v1
# with:
# reporter: 'github-pr-review'
# github_token: ${{ secrets.GITHUB_TOKEN }}
# env:
# RUST_TOOLCHAIN: stable-x86_64-linux-unknown-gnu # force clippy to build with same rust version
# CARGO_DRIFT_FFI_PATH: "/usr/lib"
- name: Test
run: |
cargo test --no-fail-fast --lib -- --nocapture
cargo test --no-fail-fast --test integration -- --nocapture --test-threads 1
env:
RUST_LOG: info
TEST_DEVNET_RPC_ENDPOINT: ${{ secrets.DEVNET_RPC_ENDPOINT }}
TEST_PRIVATE_KEY: ${{ secrets.TEST_PRIVATE_KEY }}
run: cargo test --all

CARGO_DRIFT_FFI_PATH: "/usr/lib"
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- "release/*"

jobs:
crates-io:
name: Publish to crates.io
runs-on: ubicloud
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cargo login
run: |
cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish drift-idl-gen
run: |
cd crates/drift-idl-gen
cargo publish --dry-run
- name: Publish drift-rs
run: |
cargo publish --dry-run
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/target
target
**/*/target
/tests/.env
/vendor
/vendor
**/*/build
.vscode
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "crates/drift-ffi-sys"]
path = crates/drift-ffi-sys
url = https://github.com/drift-labs/drift-ffi-sys
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
use_field_init_shorthand = true
Loading

0 comments on commit 093f0ed

Please sign in to comment.