Skip to content

Commit

Permalink
Build tlsn-core, tlsn-prover and tls-client for wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
heeckhau committed Dec 15, 2023
1 parent 3d40995 commit 450f8b8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: wasm-build

on:
push:
branches:
- dev
tags:
- "[v]?[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- dev

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
build_and_test:
name: Build for target wasm32-unknown-unknown
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- tlsn/tlsn-core
- tlsn/tlsn-prover
- components/tls/tls-client
defaults:
run:
working-directory: ${{ matrix.package }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
toolchain: stable

- name: Use caching
uses: Swatinem/[email protected]
with:
workspaces: ${{ matrix.package }} -> ../target

- name: "Build"
run: cargo build --target wasm32-unknown-unknown
4 changes: 4 additions & 0 deletions components/tls/tls-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ path = "examples/internal/bench.rs"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
ring = { version = "0.17", features = ["wasm32_unknown_unknown_js"] }
getrandom = { version = "0.2", features = ["js"] }
3 changes: 3 additions & 0 deletions tlsn/tlsn-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ bincode.workspace = true
[[test]]
name = "api"
required-features = ["fixtures"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
6 changes: 5 additions & 1 deletion tlsn/tlsn-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ derive_builder.workspace = true
opaque-debug.workspace = true
bytes.workspace = true

tracing = { workspace = true, optional = true}
tracing = { workspace = true, optional = true }

web-time.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
ring = { version = "0.17", features = ["wasm32_unknown_unknown_js"] }
getrandom = { version = "0.2", features = ["js"] }

0 comments on commit 450f8b8

Please sign in to comment.