shred 0.16.1

Dispatches systems in parallel which need read access to some resources, and write access to others.
Documentation
on:
  push:
    branches:
      - staging
      - trying
      - master
  pull_request:
    branches:
      - "**"

name: CI

jobs:
  build_and_test:
    name: Build and Test (Linux)
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - nightly
          - beta
          - stable
          - 1.65.0 # MSRV

    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true

      - uses: actions-rs/cargo@v1
        with:
          command: build
          args: --verbose --no-default-features

      - name: Clippy lints
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all --tests -- -D warnings
        if: matrix.rust == 'stable'

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --verbose --no-default-features

      - uses: actions-rs/cargo@v1
        with:
          command: build
          args: --verbose

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --verbose

  miri:
    name: "Miri"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install Miri
        run: |
          rustup toolchain install nightly --component miri
          rustup override set nightly
          cargo miri setup
      - name: Test with Miri
        # Miri currently reports leaks in some tests so we disable that check
        # here (might be due to ptr-int-ptr in crossbeam-epoch so might be
        # resolved in future versions of that crate).
        #
        # crossbeam-epoch doesn't pass with stacked borrows https://github.com/crossbeam-rs/crossbeam/issues/545
        run: MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tree-borrows" cargo miri test