Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,41 @@ jobs:
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features

wasm-check:
name: WASM walletkit-db compile check
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.92.0
targets: wasm32-unknown-unknown

- name: Install LLVM toolchain for WASM C build
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y clang-18 llvm-18

- name: Configure C toolchain for wasm32
shell: bash
run: |
set -euo pipefail
echo "CC_wasm32_unknown_unknown=clang-18" >> "$GITHUB_ENV"
echo "AR_wasm32_unknown_unknown=llvm-ar-18" >> "$GITHUB_ENV"
clang-18 --version | head -n1
llvm-ar-18 --version | head -n1

- name: Run WASM compile check
run: cargo check -p walletkit-db --target wasm32-unknown-unknown

swift-build-and-test:
name: Swift Build & Foreign Binding Tests
runs-on: macos-14
Expand Down
16 changes: 13 additions & 3 deletions walletkit-db/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ mod raw {
wasm::sqlite3_open_v2(filename.cast(), pp_db.cast(), flags, z_vfs.cast())
}
pub unsafe fn sqlite3_close_v2(db: *mut c_void) -> c_int {
wasm::sqlite3_close_v2(db.cast())
wasm::sqlite3_close(db.cast())
}
pub unsafe fn sqlite3_exec(
db: *mut c_void,
Expand Down Expand Up @@ -566,7 +566,9 @@ mod raw {
n: c_int,
destructor: isize,
) -> c_int {
wasm::sqlite3_bind_blob(stmt.cast(), index, value, n, destructor)
// WASM bindings use typed destructor callbacks; all callers pass SQLITE_TRANSIENT.
let _ = destructor;
wasm::sqlite3_bind_blob(stmt.cast(), index, value, n, wasm::SQLITE_TRANSIENT())
}
pub unsafe fn sqlite3_bind_text(
stmt: *mut c_void,
Expand All @@ -575,7 +577,15 @@ mod raw {
n: c_int,
destructor: isize,
) -> c_int {
wasm::sqlite3_bind_text(stmt.cast(), index, value.cast(), n, destructor)
// WASM bindings use typed destructor callbacks; all callers pass SQLITE_TRANSIENT.
let _ = destructor;
wasm::sqlite3_bind_text(
stmt.cast(),
index,
value.cast(),
n,
wasm::SQLITE_TRANSIENT(),
)
}
pub unsafe fn sqlite3_bind_null(stmt: *mut c_void, index: c_int) -> c_int {
wasm::sqlite3_bind_null(stmt.cast(), index)
Expand Down