Documentation
on: [push, pull_request]

name: CI

env:
  # This is required to enable the web_sys clipboard API which egui_web uses
  # https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
  # https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
  RUSTFLAGS: --cfg=web_sys_unstable_apis

jobs:
  check-wasm:
    name: Check All
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: wasm32-unknown-unknown
          override: true
      - uses: Swatinem/rust-cache@v2  

      - uses: taiki-e/install-action@cargo-binstall
      - run: cargo binstall --no-confirm --force just
      - run: just check-all

      - name: Download and install Trunk binary
        run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
      - name: Build
        run: ./trunk build