-
Notifications
You must be signed in to change notification settings - Fork 46
68 lines (61 loc) · 2.24 KB
/
wasm.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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