webbrowser 1.2.1

Open URLs in web browsers available on a platform
Documentation
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.13.1'

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]
        wasmarch: [wasm32-unknown-unknown]
    continue-on-error: ${{ matrix.rust == 'beta' || matrix.wasmarch == 'wasm64-unknown-unknown' }}
    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 ${{ matrix.wasmarch }}

      # 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 ${{ matrix.wasmarch }} -- -D warnings