test: add testing and ci for wasm (#63)

This commit is contained in:
Mingwei Samuel 2024-02-24 20:48:40 -08:00
parent 554f1d6f57
commit 23f301dd1d
3 changed files with 37 additions and 19 deletions

View file

@ -54,42 +54,45 @@ jobs:
override: true override: true
components: rustfmt components: rustfmt
- name: Run `cargo +stable check --all-targets` - uses: actions-rs/cargo@v1
uses: actions-rs/cargo@v1
with: with:
toolchain: stable toolchain: stable
command: check command: check
args: --all-targets args: --all-targets --features __proxy
- name: Run `cargo +stable check --all-targets --features tracing` - uses: actions-rs/cargo@v1
uses: actions-rs/cargo@v1
with: with:
toolchain: stable toolchain: stable
command: check command: check
args: --all-targets --features tracing args: --all-targets --features tracing,__proxy
- name: Run `cargo check --all-targets --features nightly,tracing` - uses: actions-rs/cargo@v1
uses: actions-rs/cargo@v1
with: with:
command: check command: check
args: --all-targets --features nightly,tracing args: --all-targets --features nightly,tracing,__proxy
- name: Run `cargo build --all-targets --features nightly,deny-unknown` - uses: actions-rs/cargo@v1
uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --all-targets --features nightly,deny-unknown args: --all-targets --features nightly,deny-unknown,__proxy
- name: Run `cargo test --features nightly,deny-unknown` - uses: actions-rs/cargo@v1
uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --no-fail-fast --features nightly,deny-unknown args: --no-fail-fast --features nightly,deny-unknown,__proxy
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
RUSTLOG: riven=trace RUSTLOG: riven=trace
RGAPI_KEY: ${{ secrets.RGAPI_KEY }} RGAPI_KEY: ${{ secrets.RGAPI_KEY }}
- name: Install `wasm-pack`
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- working-directory: riven
run: wasm-pack test --node -- --features nightly,deny-unknown
env:
RGAPI_KEY: ${{ secrets.RGAPI_KEY }}
lints: lints:
name: Lints name: Lints
needs: pre_job needs: pre_job

View file

@ -2,12 +2,15 @@
set -euxo pipefail set -euxo pipefail
# Ensure stable builds. # Ensure stable builds.
cargo +stable check --all-targets cargo +stable check --all-targets --features __proxy
cargo +stable check --all-targets --features tracing cargo +stable check --all-targets --features tracing,__proxy
# Ensure nightly builds. # Ensure nightly builds.
cargo check --all-targets --features nightly,tracing cargo check --all-targets --features nightly,tracing,__proxy
cargo build --all-targets --features nightly,deny-unknown cargo build --all-targets --features nightly,deny-unknown,__proxy
# Run nightly tests. # Run nightly tests.
bash test.bash bash test.bash
# Run wasm tests.
bash test-wasm.bash

12
test-wasm.bash Normal file
View file

@ -0,0 +1,12 @@
#!/bin/bash
set -euxo pipefail
export RGAPI_KEY="$(cat apikey.txt)"
cd riven
# Ensure builds with tracing.
wasm-pack build -- --features nightly,tracing
# Run tests.
wasm-pack test --node -- --no-fail-fast --features nightly,deny-unknown