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

ci: add job for building and uploading tlsn-wasm build result #553

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:

- name: Test
run: cargo test
build-wasm:
name: Build and test wasm
wasm:
name: Build and Test wasm
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -97,6 +97,20 @@ jobs:
run: |
cd crates/wasm-test-runner
./run.sh

- name: Run build
run: |
cd crates/wasm
./build.sh

- name: Save artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}-tlsn-wasm-pkg
path: ./crates/wasm/pkg
if-no-files-found: error

tests-integration:
name: Run tests release build
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions crates/wasm/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/bin/sh
set -e

# Clean up older builds
rm -rf pkg

# Build tlsn_wasm package
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
rustup run nightly \
wasm-pack build --target web . -- -Zbuild-std=panic_abort,std

# Patch tlsn_wasm.js import in workerHelpers.worker.js
file=$(ls ./pkg/snippets/wasm-bindgen-rayon-*/src/workerHelpers.worker.js)
temp=$(mktemp)
sed 's|../../../|../../../tlsn_wasm.js|' "$file" >"$temp" && mv "$temp" "$file"

# Add snippets directory to package.json
file="pkg/package.json"
temp=$(mktemp)
jq '.files += ["snippets/"]' "$file" >"$temp" && mv "$temp" "$file"