name: CI-PR
on:
  pull_request:
    branches: [master, main]
concurrency:
  group: ci-pr-${{ github.ref }}
  cancel-in-progress: true
jobs:
  ci-pr:
    name: CI-PR
    needs: [test-minimal, test-full]
    runs-on: ubuntu-latest
    steps:
      - name: Done
        run: exit 0
  test-minimal:
    name: Tests (Minimal)
    env:
      FLAGS: --no-default-features
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        rust: [stable]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - name: Cache Builds
        uses: Swatinem/rust-cache@v1
      - name: Checkout
        uses: actions/checkout@v2
      - name: Compile
        run: cargo test --no-run ${{ env.FLAGS }}
      - name: Test
        run: cargo test ${{ env.FLAGS }}
  test-full:
    name: Tests (Full)
    env:
      FLAGS: --all-features
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        rust: [stable]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - name: Cache Builds
        uses: Swatinem/rust-cache@v1
      - name: Checkout
        uses: actions/checkout@v2
      - name: Compile
        run: cargo test --no-run ${{ env.FLAGS }}
      - name: Test
        run: cargo test ${{ env.FLAGS }}
  run:
    name: Run cargo-outdated
    env:
      FLAGS: --all-features
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        rust: [stable]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - name: Cache Builds
        uses: Swatinem/rust-cache@v1
      - name: Checkout
        uses: actions/checkout@v2
      - name: Compile
        run: cargo build ${{ env.FLAGS }}
      - name: Test
        continue-on-error: true
        run: cargo run ${{ env.FLAGS }} -- outdated
