name: Check

on:
  push:
    branches-ignore: [staging.tmp]
  pull_request:
    branches-ignore: [staging.tmp]

jobs:
  ios_build:
    name: iOS Stable
    runs-on: macos-10.15
    env:
      TARGET: aarch64-apple-ios
    steps:
      - uses: actions/checkout@v2
      - run: rustup target add ${{ env.TARGET }}
      - run: make check-target

  uwp_build:
    name: UWP Nightly
    runs-on: windows-2019
    env:
      TARGET: x86_64-uwp-windows-msvc
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2
      - name: Install latest nightly
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
          components: rust-src
      - run: cargo build -Z build-std --manifest-path libportability/Cargo.toml --features dx12 --target ${{ env.TARGET }}

  build:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-18.04, macos-10.15, windows-2019]
        channel: [stable, nightly]
        exclude:
          - os: ubuntu-18.04
            channel: stable
          - os: macos-10.15
            channel: nightly
          - os: windows-2019
            channel: nightly
        include:
          - name: Ubuntu Nightly
            os: ubuntu-18.04
            channel: nightly
          - name: MacOS Stable
            os: macos-10.15
            channel: stable
          - name: Windows Stable
            os: windows-2019
            channel: stable
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - if: matrix.channel == 'nightly'
        name: Install latest nightly
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
      - if: matrix.os == 'windows-2019'
        name: Install make
        run: choco install make
      - run: make all