ruffle/.github/workflows/test_web.yml

113 lines
3.2 KiB
YAML
Raw Normal View History

name: Test Web
on:
push:
2021-08-25 19:15:02 +00:00
branches: [master]
pull_request:
2021-08-25 19:15:02 +00:00
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Paths filter
runs-on: ubuntu-22.04
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
2022-12-01 21:04:32 +00:00
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- '!**.md'
build:
needs: changes
if: needs.changes.outputs.src == 'true'
2021-02-01 03:07:36 +00:00
name: Test Node.js ${{ matrix.node_version }} / Rust ${{ matrix.rust_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.rust_version == 'nightly' }}
strategy:
fail-fast: false
matrix:
node_version: ["18", "19"]
rust_version: [stable] # We most likely don't care about Rust versions here, we'll catch those issues in test_rust.yml.
os: [ubuntu-22.04, windows-latest]
steps:
2022-12-01 21:04:32 +00:00
- uses: actions/checkout@v3
2021-02-01 03:07:36 +00:00
2021-08-25 19:15:02 +00:00
- name: Setup Node.js ${{ matrix.node_version }}
2022-12-01 21:04:32 +00:00
uses: actions/setup-node@v3
2021-08-25 19:15:02 +00:00
with:
node-version: ${{ matrix.node_version }}
cache: npm
cache-dependency-path: web/package-lock.json
2021-08-25 19:15:02 +00:00
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
2021-08-25 19:15:02 +00:00
with:
toolchain: ${{ matrix.rust_version }}
targets: wasm32-unknown-unknown
- name: Cache Cargo output
uses: Swatinem/rust-cache@v2
with:
shared-key: "web"
2021-08-25 19:15:02 +00:00
# wasm-bindgen-cli version must match wasm-bindgen crate version.
# Be sure to update in release_nightly.yml, web/Cargo.toml and web/README.md.
- name: Install wasm-bindgen
run: cargo install wasm-bindgen-cli --version 0.2.84
2021-08-25 19:15:02 +00:00
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: binaryen
2021-08-25 19:15:02 +00:00
# conda is available only with "shell: bash -l {0}".
# See https://github.com/marketplace/actions/setup-miniconda.
- name: Install binaryen
shell: bash -l {0}
run: conda install -c conda-forge binaryen
2021-08-25 19:15:02 +00:00
- name: Build
env:
# Verify that all features build.
CARGO_FLAGS: --locked --all-features
2021-08-25 19:15:02 +00:00
working-directory: web
shell: bash -l {0}
run: |
npm ci
2021-08-25 19:15:02 +00:00
npm run build
2021-02-01 03:07:36 +00:00
2021-08-25 19:15:02 +00:00
- name: Check formatting
working-directory: web
run: npm run lint
2021-08-25 19:15:02 +00:00
- name: Run tests
# MIKE: Don't run web tests on Windows because it's flaky for unknown reasons. :-(
if: runner.os == 'Linux'
2021-08-25 19:15:02 +00:00
working-directory: web
run: npm test
check-required:
needs: changes
if: needs.changes.outputs.src == 'false'
name: Test Node.js ${{ matrix.node_version }} / Rust ${{ matrix.rust_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ["18", "19"]
rust_version: [stable] # We most likely don't care about Rust versions here, we'll catch those issues in test_rust.yml.
os: [ubuntu-22.04, windows-latest]
steps:
- name: No-op
run: echo noop