Skip to content

Commit f29af8a

Browse files
authored
Feat/wasm (#294)
* chore: Replace `dirs` with `local storage` during `wasm`. * chore: Using MemoryStorage in a WASM environment * ci: add wasm test and examples * chore: codefmt
1 parent df31a5f commit f29af8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1324
-195
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.wasm32-unknown-unknown]
2+
rustflags = ["--cfg=getrandom_backend=\"wasm_js\""]

.github/workflows/ci.yml

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,78 @@ jobs:
9090
with:
9191
command: run
9292
args: --bin sqllogictest-test --manifest-path ./tests/sqllogictest/Cargo.toml
93-
# codecov:
94-
# name: Upload coverage reports to Codecov
95-
# runs-on: ubuntu-latest
96-
# steps:
97-
# - name: Upload coverage reports to Codecov
98-
# uses: codecov/codecov-action@v3
99-
# with:
100-
# files: ./lcov.info
101-
# flags: rust
102-
# env:
103-
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
93+
# 4
94+
wasm-tests:
95+
name: Wasm cargo tests
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/checkout@v2
99+
100+
- name: Install stable with wasm target
101+
uses: actions-rs/toolchain@v1
102+
with:
103+
toolchain: stable
104+
target: wasm32-unknown-unknown
105+
override: true
106+
107+
- name: Setup Node.js
108+
uses: actions/setup-node@v4
109+
with:
110+
node-version: 20
111+
112+
- name: Install wasm-pack
113+
uses: jetli/[email protected]
114+
with:
115+
version: latest
116+
117+
- name: Run wasm-bindgen tests (wasm32 target)
118+
run: wasm-pack test --node -- --package kite_sql --lib
119+
# 5
120+
wasm-examples:
121+
name: Wasm examples (nodejs)
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v2
125+
126+
- name: Install stable with wasm target
127+
uses: actions-rs/toolchain@v1
128+
with:
129+
toolchain: stable
130+
target: wasm32-unknown-unknown
131+
override: true
132+
133+
- name: Setup Node.js
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: 20
137+
138+
- name: Install wasm-pack
139+
uses: jetli/[email protected]
140+
with:
141+
version: latest
142+
143+
- name: Build wasm package
144+
run: wasm-pack build --release --target nodejs
145+
146+
- name: Run wasm example scripts
147+
run: |
148+
node examples/wasm_hello_world.test.mjs
149+
node examples/wasm_index_usage.test.mjs
150+
# 6
151+
native-examples:
152+
name: Native examples
153+
runs-on: ubuntu-latest
154+
steps:
155+
- uses: actions/checkout@v2
156+
157+
- name: Install stable toolchain
158+
uses: actions-rs/toolchain@v1
159+
with:
160+
toolchain: stable
161+
override: true
162+
163+
- name: Run hello_world example
164+
run: cargo run --example hello_world
165+
166+
- name: Run transaction example
167+
run: cargo run --example transaction

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ target/
1616
/.obsidian
1717
.DS_Store
1818

19-
/hello_world
20-
/transaction
19+
/example_data
2120

2221
kitesql_data
2322
kitesql_bench

0 commit comments

Comments
 (0)