Skip to content

WASM

WASM #216

Workflow file for this run

name: WASM
on:
push:
branches-ignore: [ '**win**', '**android**', '**linux**', '**bsd**', '**haiku**', '**macos**', '**ios**' ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * SUN'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_LOG: webbrowser=TRACE
WASM_PACK_VERSION: '0.10.3'
WASM_TARGET: wasm32-unknown-unknown
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '#build-') || contains(github.event.head_commit.message, '#build-wasm') }}
strategy:
max-parallel: 1
matrix:
rust: [stable, beta]
continue-on-error: ${{ matrix.rust != 'stable' && matrix.rust != 'beta' }}
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Install rust version
run: |
rustup install ${{ matrix.rust }} --profile minimal
rustup component add --toolchain ${{ matrix.rust }} rustfmt clippy
rustup target add ${{ env.WASM_TARGET }}
# Install wasm-pack
- uses: actions/cache@v3
name: Fetch wasm-pack from cache
id: wasm-pack-cache
with:
path: ~/.cargo/bin/wasm-pack
key: wasm-pack-${{ env.WASM_PACK_VERSION }}
- name: Install wasm-pack
if: steps.wasm-pack-cache.outputs.cache-hit != 'true'
run: cargo install wasm-pack --version ${{ env.WASM_PACK_VERSION }}
# Compile using WEBBROWSER_WASM_TARGET=_self so that we don't encounter popup blockers
- name: Compile
env:
RUST_LOG: info
WEBBROWSER_WASM_TARGET: _self
run: rustup run ${{ matrix.rust }} wasm-pack build --target web --dev
working-directory: tests/test-wasm-app
# Run tests
- name: Run tests
env:
BROWSER: firefox --screenshot %s
run: cargo +${{ matrix.rust }} test --test test_wasm -- --ignored
# Code format, linting etc.
- name: Check Code Formatting
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }}
run: cargo +${{ matrix.rust }} fmt --all -- --check
- name: Lints
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }}
run: cargo +${{ matrix.rust }} clippy --target ${{ env.WASM_TARGET }} -- -D warnings