Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make tonbo build under wasm32 arch #216

Merged
merged 8 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: run
args: --example declare --all-features
args: --example declare --features bytes,tokio

benchmark:
name: Rust benchmark
Expand All @@ -109,7 +109,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: bench
args: --all-features
args: --features bench

- name: Comment on PR using GitHub CLI
env:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/ci_wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: WASM CI

on:
push:
pull_request:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_MY_REGISTRY_INDEX: https://github.com/rust-lang/crates.io-index


jobs:
check:
name: Rust project wasm check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: check

- name: Setup for wasm32
run: |
rustup target add wasm32-unknown-unknown

- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --target wasm32-unknown-unknown --no-default-features --features aws,bytes,opfs

- name: Install Chrome Environment
run: |
mkdir -p /tmp/chrome
wget $(curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions | sort_by(.version) | reverse | .[0] | .downloads.chrome | .[] | select(.platform == "linux64") | .url')
wget $(curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions | sort_by(.version) | reverse | .[0] | .downloads.chromedriver | .[] | select(.platform == "linux64") | .url')
unzip chromedriver-linux64.zip
unzip chrome-linux64.zip
cp -r chrome-linux64/ /tmp/chrome/
cp -r chromedriver-linux64 /tmp/chrome/chromedriver

- name: Setup wasm-pack
run: |
cargo install wasm-pack

- name: Run wasm-pack test
run: |
export PATH=$PATH:/tmp/chrome/chrome-linux64/:/tmp/chrome/chromedriver-linux64/
wasm-pack test --chrome --headless --test wasm --no-default-features --features aws,bytes,opfs
59 changes: 42 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,30 @@ version = "0.2.0"
msrv = "1.79.0"

[features]
aws = ["fusio/aws", "fusio-dispatch/aws"]
bench = ["redb", "rocksdb", "sled"]
bytes = ["dep:bytes"]
datafusion = ["dep:async-trait", "dep:datafusion"]
default = ["bytes", "tokio"]
default = ["aws", "bytes", "tokio", "tokio-http"]
load_tbl = []
object-store = ["fusio/object_store"]
opfs = [
"dep:wasm-bindgen-futures",
"fusio-dispatch/opfs",
"fusio/opfs",
"fusio-parquet/opfs",
]
redb = ["dep:redb"]
rocksdb = ["dep:rocksdb"]
sled = ["dep:sled"]
tokio = ["tokio/fs"]
tokio = [
"fusio-dispatch/tokio",
"fusio-parquet/tokio",
"fusio/tokio",
"parquet/default",
"tokio/fs",
]
tokio-http = ["fusio/tokio-http"]

[[example]]
name = "declare"
Expand Down Expand Up @@ -58,25 +73,25 @@ crc32fast = "1"
crossbeam-skiplist = "0.1"
datafusion = { version = "42", optional = true }
flume = { version = "0.11", features = ["async"] }
fusio = { package = "fusio", version = "0.3.3", features = [
"aws",
fusio = { git = "https://github.com/tonbo-io/fusio.git", rev = "8038993675591f87dd65b88ffdade31dc0a254b7", package = "fusio", version = "0.3.3", features = [
"dyn",
"fs",
"object_store",
"tokio",
"tokio-http",
] }
fusio-dispatch = { package = "fusio-dispatch", version = "0.2.1", features = [
"aws",
"tokio",
] }
fusio-parquet = { package = "fusio-parquet", version = "0.2.1" }
fusio-dispatch = { git = "https://github.com/tonbo-io/fusio.git", rev = "8038993675591f87dd65b88ffdade31dc0a254b7", package = "fusio-dispatch", version = "0.2.1" }
fusio-parquet = { git = "https://github.com/tonbo-io/fusio.git", rev = "8038993675591f87dd65b88ffdade31dc0a254b7", package = "fusio-parquet", version = "0.2.1" }
futures-core = "0.3"
futures-io = "0.3"
futures-util = "0.3"
lockable = "0.0.8"
once_cell = "1"
parquet = { version = "53", features = ["async"] }
parquet = { version = "53", default-features = false, features = [
"async",
"base64",
"brotli",
"flate2",
"lz4",
"snap",
] }
pin-project-lite = "0.2"
regex = "1"
thiserror = "1"
Expand All @@ -92,18 +107,28 @@ redb = { version = "2", optional = true }
rocksdb = { version = "0.22", optional = true }
sled = { version = "0.34", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2.95"
wasm-bindgen-futures = { version = "0.4.45", optional = true }

[dev-dependencies]
bincode = "1"
comfy-table = "7"
criterion = { version = "0.5", features = ["async_tokio", "html_reports"] }
fastrand = "2"
futures = { version = "0.3" }
mimalloc = "0.1"
serde = "1"
tempfile = "3"
tokio = { version = "1", features = ["full"] }
trybuild = "1.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
comfy-table = "7"
criterion = { version = "0.5", features = ["async_tokio", "html_reports"] }
mimalloc = "0.1"
tokio = { version = "1", features = ["full"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen = "0.2.95"
wasm-bindgen-test = "0.3.9"

[target.'cfg(unix)'.dev-dependencies]
pprof = { version = "0.13", features = ["criterion", "flamegraph"] }

Expand Down
7 changes: 5 additions & 2 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ crate-type = ["cdylib"]
[workspace]

[dependencies]
fusio = { package = "fusio", version = "0.3.1", features = ["aws", "tokio"] }
fusio-dispatch = { package = "fusio-dispatch", version = "0.2.0", features = [
fusio = { git = "https://github.com/tonbo-io/fusio.git", rev = "8038993675591f87dd65b88ffdade31dc0a254b7", package = "fusio", version = "0.3.1", features = [
"aws",
"tokio",
] }
fusio-dispatch = { git = "https://github.com/tonbo-io/fusio.git", rev = "8038993675591f87dd65b88ffdade31dc0a254b7", package = "fusio-dispatch", version = "0.2.0", features = [
"aws",
"tokio",
] }
Expand Down
Loading
Loading