on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

name: Lints

jobs:
  clippy-stable:
    name: Clippy
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
        mode:
          - ""
          - --release
        features:
          - ""
          - --features alloc
          - --features std
          - --features impl_parking_lot
          - --features impl_crossbeam
          - --features impl_parking_lot,impl_crossbeam

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

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

      - name: Run cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: ${{ matrix.mode }} --no-default-features ${{ matrix.features }} -- -D warnings

  clippy-nightly:
    name: Clippy Nightly
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - nightly
        mode:
          - ""
          - --release
        features:
          - ""
          - --features alloc
          - --features std
          - --features impl_parking_lot
          - --features impl_crossbeam
          - --features impl_parking_lot,impl_crossbeam
        nightly:
          - ""
          - --features nightly

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

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

      - name: Run cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: ${{ matrix.mode }} --no-default-features ${{ matrix.nightly }} ${{ matrix.features }} -- -D warnings

  clippy-stable-target:
    name: Clippy Target
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
        mode:
          - ""
          - --release
        features:
          - ""
          - --features alloc
          - --features impl_crossbeam

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

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: clippy
          target: armv7a-none-eabi

      - name: Run cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: ${{ matrix.mode }} --target armv7a-none-eabi --no-default-features ${{ matrix.features }} -- -D warnings

  clippy-nightly-target:
    name: Clippy Nightly Target
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - nightly
        mode:
          - ""
          - --release
        features:
          - ""
          - --features alloc
          - --features impl_crossbeam
        nightly:
          - ""
          - --features nightly

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

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: clippy
          target: armv7a-none-eabi

      - name: Run cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: ${{ matrix.mode }} --target armv7a-none-eabi --no-default-features ${{ matrix.nightly }} ${{ matrix.features }} -- -D warnings

  doc:
    name: Doc
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
          - nightly
        mode:
          - ""
          - --release

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

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

      - name: Run cargo doc
        uses: actions-rs/cargo@v1
        with:
          command: doc
          args: ${{ matrix.mode }}
