name: CI
on:
  push:
    branches: [staging, trying]
jobs:
  ci:
    name: CI
    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - name: Done
        run: exit 0
  test:
    name: Tests
    strategy:
      fail-fast: true
      matrix:
        rust: [stable, beta]
        os: [windows-latest, macOS-latest, ubuntu-latest]
        target:
          - x86_64-pc-windows-msvc
          - x86_64-pc-windows-gnu
          - x86_64-unknown-linux-gnu
          - x86_64-apple-darwin
        exclude:
          # Exclude combinations that don't make sense
          - os: windows-latest
            target: x86_64-apple-darwin
          - os: windows-latest
            target: x86_64-unknown-linux-gnu
          - os: macos-latest
            target: x86_64-pc-windows-msvc
          - os: macos-latest
            target: x86_64-pc-windows-gnu
          - os: macos-latest
            target: x86_64-unknown-linux-gnu
          - os: ubuntu-latest
            target: x86_64-pc-windows-msvc
          - os: ubuntu-latest
            target: x86_64-pc-windows-gnu
          - os: ubuntu-latest
            target: x86_64-apple-darwin
    runs-on: ${{ matrix.os }}
    steps:
      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          target: ${{ matrix.target }}
          override: true
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install Just
        run: cargo install just cargo-nextest
      - name: Install linker
        if: matrix.target == 'x86_64-pc-windows-gnu'
        uses: egor-tensin/setup-mingw@v2
      - name: OpenSSL Libs
        if: matrix.os == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install libssl-dev
      - name: Test
        run: just test
