name: Rust

on: [push, pull_request]

jobs:
  build:
    strategy:
      matrix:
        include:
          - rust: nightly
          - rust: stable
            extra-test-opts: -- --skip ui
          - rust: 1.56
            extra-test-opts: -- --skip ui
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        profile: minimal
        default: true
    - uses: taiki-e/install-action@cargo-hack
    - run: cargo hack build --feature-powerset
    - run: cargo test --all ${{ matrix.extra-test-opts }}
  clippy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: nightly
        override: true
        components: clippy
    - uses: taiki-e/install-action@cargo-hack
    - run: cargo hack clippy --workspace -- -D warnings
