add wasm support (#700)

* get started

* make it work again

* make it compile again

* Use async-wasm-feature of jsonrpsee from the master branch

* Ensure we enable JS feature of getrandom for the wasm target

* Update subxt/src/lib.rs

* update jsonrpsee

* fix CI

* cargo fmt

* fix wasm test

* fix grumbles

* exclude wasm-tests from workspace

To avoid leaking `jsonrpsee-web` feature into the workspace

Co-authored-by: Igor Matuszewski <xanewok@gmail.com>
This commit is contained in:
Niklas Adolfsson
2022-11-14 12:45:21 +01:00
committed by GitHub
parent 71e58b2c16
commit 14e8e6f6b6
13 changed files with 144 additions and 50 deletions
+32 -4
View File
@@ -42,11 +42,14 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
- name: Build
uses: actions-rs/cargo@v1.0.3
- name: Install cargo-hack
uses: baptiste0928/cargo-install@v1
with:
command: check
args: --all-targets --all-features --workspace
crate: cargo-hack
version: 0.5
- name: Cargo check
run: cargo hack --exclude-all-features --each-feature check --all-targets --workspace
fmt:
name: Cargo fmt
@@ -165,3 +168,28 @@ jobs:
with:
command: clippy
args: --all-targets -- -D warnings
wasm_tests:
name: Test wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Download Substrate
run: |
curl $SUBSTRATE_URL --output substrate --location
chmod +x substrate
mkdir -p ~/.local/bin
mv substrate ~/.local/bin
- name: Run WASM tests
run: |
substrate --dev --tmp > /dev/null 2>&1 &
wasm-pack test --headless --firefox
wasm-pack test --headless --chrome
pkill substrate
working-directory: testing/wasm-tests