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
components: rustfmt
- name: Run `cargo +stable check --all-targets`
uses: actions-rs/cargo@v1
- uses: actions-rs/cargo@v1
with:
toolchain: stable
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:
toolchain: stable
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:
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:
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:
command: test
args: --no-fail-fast --features nightly,deny-unknown
args: --no-fail-fast --features nightly,deny-unknown,__proxy
env:
RUST_BACKTRACE: 1
RUSTLOG: riven=trace
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:
name: Lints
needs: pre_job

View file

@ -2,12 +2,15 @@
set -euxo pipefail
# Ensure stable builds.
cargo +stable check --all-targets
cargo +stable check --all-targets --features tracing
cargo +stable check --all-targets --features __proxy
cargo +stable check --all-targets --features tracing,__proxy
# Ensure nightly builds.
cargo check --all-targets --features nightly,tracing
cargo build --all-targets --features nightly,deny-unknown
cargo check --all-targets --features nightly,tracing,__proxy
cargo build --all-targets --features nightly,deny-unknown,__proxy
# Run nightly tests.
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