trunk 0.7.1

Build, bundle & ship your Rust WASM application to the web.
name: ci
on:
  push:
    paths-ignore:
      - "**.md"
  pull_request:
    paths-ignore:
      - "**.md"

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

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

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          components: clippy, rustfmt

      - name: Build | Clippy
        run: cargo clippy -- -D warnings

      - name: Build | Format
        run: cargo fmt -- --check

  check:
    runs-on: ubuntu-latest
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

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

      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal

      - name: Build | Check
        run: cargo check --all

  test:
    needs: check # Ensure check is run first.
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        include:
          - os: ubuntu-latest
            binPath: target/debug/trunk
          - os: macos-latest
            binPath: target/debug/trunk
          - os: windows-latest
            binPath: target/debug/trunk.exe
    runs-on: ${{ matrix.os }}
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

      - name: Setup | Cache Cargo
        # WHY? Because we are getting: error[E0463]: can't find crate for `structopt_derive` which `structopt` depends on
        # only on macos when using the cache.
        if: matrix.os != 'macos-latest'
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Setup | Cache Examples
        uses: actions/cache@v2
        with:
          path: examples/yew/target
          key: wasm32-example-yew-debug-${{ hashFiles('examples/yew/Cargo.lock') }}

      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          target: wasm32-unknown-unknown

      - name: Build | Test
        run: cargo test

      # Run the CLI to ensure we don't have any subtle runtime issues.
      - name: Build | Run
        run: cargo run -- -h

      # TODO: finish this up as part of #57
      # # build examples via our newly built debug artifact
      # - name: Setup | wasm-bindgen
      #   run: cargo install wasm-bindgen-cli --version 0.2.68
      # - name: Build | Examples
      #   run: ${{ matrix.binPath }} --config=examples/yew/Trunk.toml build