Skip to content

Commit a9001c5

Browse files
committed
Publish wasm builds.
1 parent 4ed0e19 commit a9001c5

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

.github/workflows/release.yml

+44
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,47 @@ jobs:
237237
repo-token: ${{ secrets.GITHUB_TOKEN }}
238238
file-name: libpowersync_x64.dylib
239239
tag: ${{ needs.draft_release.outputs.tag }}
240+
241+
poblish_wasm:
242+
name: Publish WASM builds
243+
needs: [draft_release]
244+
runs-on: ubuntu-latest
245+
steps:
246+
- uses: actions/checkout@v3
247+
with:
248+
submodules: true
249+
250+
- name: Install Rust Nightly
251+
uses: dtolnay/rust-toolchain@stable
252+
with:
253+
toolchain: nightly-2024-05-18
254+
components: rust-src
255+
256+
- name: Setup emsdk
257+
uses: mymindstorm/setup-emsdk@v14
258+
with:
259+
version: 3.1.68
260+
261+
- name: Build WASM SIDE_MODULE
262+
run: ./tool/build_wasm.sh
263+
264+
- name: Upload libpowersync.wasm
265+
uses: ./.github/actions/upload
266+
with:
267+
repo-token: ${{ secrets.GITHUB_TOKEN }}
268+
file-name: libpowersync.wasm
269+
tag: ${{ needs.draft_release.outputs.tag }}
270+
271+
- name: Upload libpowersync-async.wasm
272+
uses: ./.github/actions/upload
273+
with:
274+
repo-token: ${{ secrets.GITHUB_TOKEN }}
275+
file-name: libpowersync-async.wasm
276+
tag: ${{ needs.draft_release.outputs.tag }}
277+
278+
- name: Upload libpowersync.a
279+
uses: ./.github/actions/upload
280+
with:
281+
repo-token: ${{ secrets.GITHUB_TOKEN }}
282+
file-name: libpowersync.a
283+
tag: ${{ needs.draft_release.outputs.tag }}

.github/workflows/wasm.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
name: "linux"
3+
name: "wasm"
44
jobs:
55
build_wasm:
66
name: Basic WASM build
@@ -21,8 +21,5 @@ jobs:
2121
with:
2222
version: 3.1.68
2323

24-
- name: Build WASM bytecode
25-
run: RUSTFLAGS="--emit=llvm-bc -C linker=/bin/true" cargo build -p powersync_loadable --profile wasm --no-default-features --features "powersync_core/static powersync_core/omit_load_extension sqlite_nostd/static sqlite_nostd/omit_load_extension" -Z build-std=panic_abort,core,alloc --target wasm32-unknown-emscripten
26-
2724
- name: Build WASM SIDE_MODULE
2825
run: ./tool/build_wasm.sh

tool/build_wasm.sh

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ RUSTFLAGS="-C link-arg=-sSIDE_MODULE=2" \
1212
-Z build-std=panic_abort,core,alloc \
1313
--target wasm32-unknown-emscripten
1414

15+
cp "target/wasm32-unknown-emscripten/wasm/powersync.wasm" "libpowersync.wasm"
1516

1617
# Asyncify
1718
# target/wasm32-unknown-emscripten/wasm_asyncify/powersync.wasm
@@ -24,6 +25,8 @@ RUSTFLAGS="-C link-arg=-sSIDE_MODULE=2 -C link-arg=-sASYNCIFY=1 -C link-arg=-sJS
2425
-Z build-std=panic_abort,core,alloc \
2526
--target wasm32-unknown-emscripten
2627

28+
cp "target/wasm32-unknown-emscripten/wasm_asyncify/powersync.wasm" "libpowersync-async.wasm"
29+
2730

2831
# Static lib.
2932
# Works for both sync and asyncify builds.
@@ -34,3 +37,5 @@ cargo build \
3437
--profile wasm \
3538
-Z build-std=panic_abort,core,alloc \
3639
--target wasm32-wasi
40+
41+
cp "target/wasm32-wasi/wasm/libpowersync.a" "libpowersync.wasm"

0 commit comments

Comments
 (0)