name: CI

on: [push, pull_request]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: "${{ matrix.os.name }} ${{ matrix.test.name }} (${{ matrix.toolchain }})"

    strategy:
      matrix:
        os:
          - { name: Linux, distro: ubuntu-latest }
          - { name: Windows, distro: windows-latest }
          - { name: macOS, distro: macOS-latest }
        toolchain: [nightly, beta, stable]
        include:
          - os: { name: Linux, distro: ubuntu-latest }
            toolchain: 1.0.0

    runs-on: ${{ matrix.os.distro }}

    steps:
      - name: Checkout Sources
        uses: actions/checkout@v2

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

      - name: Run Tests
        uses: actions-rs/cargo@v1
        env:
          FORCE_STATIC: 1
          KNOWN_CHANNEL: ${{ matrix.toolchain }}
        with:
          command: test
