name: Build
on:
  push:
    branches: [master]
  pull_request:
    branches: [master]
    types: [opened, synchronize, reopened]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout from repo
        uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          target: wasm32-unknown-unknown
      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
        with:
          workspaces: wgpu-compute-toy
      - run: cargo install wasm-pack
      - uses: actions/setup-node@v4
        with:
          node-version: node
          cache: 'yarn'
      - run: yarn
      - run: yarn build