name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - "**"

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0

jobs:
  tests:
    name: Unix tests
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os: [macos-latest, ubuntu-latest]
        toolchain: [stable]
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2

      - name: Cache artifacts
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          profile: minimal
          override: true

      - name: Install emscripten
        run: eval $(script/fetch-emscripten)
        if: matrix.os == 'macos-latest'

      - name: Build C library
        run: make

      - name: Build wasm library
        run: script/build-wasm

      - name: Build CLI
        run: cargo build --release

      - name: Set up fixture parsers
        run: |
          script/fetch-fixtures
          script/generate-fixtures
          script/generate-fixtures-wasm

      - name: Run main tests
        run: script/test

      - name: Run wasm tests
        run: script/test-wasm

      - name: Run benchmarks
        run: script/benchmark

name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - "**"

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0

jobs:
  tests:
    name: Unix tests
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os: [macos-latest, ubuntu-latest]
        toolchain: [stable]
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2

      - name: Cache artifacts
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            emsdk-cache
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.toolchain }}
          profile: minimal
          override: true

      - name: Install emscripten
        uses: mymindstorm/setup-emsdk@v7
        with:
          version: 2.0.11
          actions-cache-folder: emsdk-cache

      - name: Build C library
        run: make

      - name: Build wasm library
        run: script/build-wasm

      - name: Build CLI
        run: cargo build --release

      - name: Set up fixture parsers
        run: |
          script/fetch-fixtures
          script/generate-fixtures
          script/generate-fixtures-wasm

      - name: Run main tests
        run: script/test

      - name: Run wasm tests
        run: script/test-wasm

      - name: Run benchmarks
        run: script/benchmark

Use a publisehd action for setting up emscripten on CI
Use a publisehd action for setting up emscripten on CI
