name: WASM
on:
push:
branches-ignore: [ '**win**', '**android**', '**linux**', '**bsd**', '**haiku**', '**macos**', '**ios**' ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
WASM_PACK_VERSION: '0.10.2'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
continue-on-error: ${{ matrix.rust != 'stable' }}
steps:
- uses: actions/checkout@v2
name: Checkout
- uses: actions-rs/toolchain@v1
name: Install Rust Toolchain
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
target: wasm32-unknown-unknown
- uses: actions/cache@v2
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'
uses: actions-rs/install@v0.1
with:
crate: wasm-pack
version: ${{ env.WASM_PACK_VERSION }}
use-tool-cache: false
- name: Compile
env:
WEBBROWSER_WASM_TARGET: _self
run: wasm-pack build --target web --dev
working-directory: tests/test-wasm-app
- name: Install firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: '97.0'
- name: Custom headless firefox script
run: |
echo 'nohup firefox --headless "$*" >/dev/null 2>&1 &' > /tmp/hffox
chmod 755 /tmp/hffox
- name: Run tests
env:
BROWSER: /tmp/hffox %s
run: cargo test --test test_wasm -- --ignored
- uses: actions-rs/cargo@v1
name: Check Code Formatting
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
name: Lints
with:
command: clippy
args: --all-targets -- -D warnings