refactor(sia_js): universal JS SDK #333
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Environment | |
run: | | |
rustup update stable | |
rustup toolchain install nightly | |
rustup target add wasm32-unknown-unknown | |
rustup component add rustfmt --toolchain nightly | |
- name: Build for wasm | |
# Check if the library target compiles. This will still allow for using | |
# non-wasm functionality in tests and benchmarks but guarantees that | |
# consumers of the library can use it to generate wasm bindings. | |
run: cargo check --target wasm32-unknown-unknown --lib | |
- name: Rustfmt | |
run: cargo +nightly fmt --all -- --check | |
- name: Clippy | |
run: cargo clippy -- -D warnings | |
- name: Test | |
run: cargo test | |
sia_js: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Environment | |
run: | | |
rustup update stable | |
cargo install wasm-pack | |
- name: Test Browser JS | |
working-directory: sia_js | |
run: | | |
wasm-pack test --headless --${{matrix.browser}} -- --features=test_in_browser | |
- name: Test JS Firefox | |
working-directory: sia_js | |
run: | | |
wasm-pack test --headless --firefox -- --features=test_in_browser | |
- name: Test JS node.js | |
working-directory: sia_js | |
run: | | |
wasm-pack test --node | |
- name: Build JS node.js | |
working-directory: sia_js | |
run: wasm-pack build --target=nodejs | |
- name: Build JS browser | |
working-directory: sia_js | |
run: wasm-pack build --target=web |