memmap2 0.3.1

Cross-platform Rust API for memory-mapped file IO
Documentation
name: Rust

on: [push, pull_request]

env:
  CARGO_TERM_COLOR: always

jobs:
  check:
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Install toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        profile: minimal
        target: x86_64-pc-windows-gnu

    - name: Run checks
      env:
        CLIPPY_OPTS: --all-targets -- --allow clippy::len_without_is_empty --allow clippy::missing_safety_doc
      run: |
        cargo fmt -- --check
        cargo clippy $CLIPPY_OPTS
        cargo clippy --target x86_64-pc-windows-gnu $CLIPPY_OPTS

  test-win:
    runs-on: windows-2019
    strategy:
      matrix:
        target:
          - i686-pc-windows-gnu
          - i686-pc-windows-msvc
          - x86_64-pc-windows-gnu
          - x86_64-pc-windows-msvc
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set default target
      run: rustup default stable-${{ matrix.target }}

    - name: Run tests
      run: cargo test

  test-macos-catalina:
    runs-on: macos-10.15
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Run tests
      run: cargo test

  test-linux:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        target:
          - i686-unknown-linux-gnu
          - x86_64-unknown-linux-gnu
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set default target
      run: rustup default stable-${{ matrix.target }}

    - name: Install multilib
      if: ${{ matrix.target == 'i686-unknown-linux-gnu' }}
      run: sudo apt install gcc-multilib

    - name: Run tests
      run: cargo test

  check-stub:
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Install toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        profile: minimal
        target: wasm32-unknown-unknown
        override: true

    - name: Run check
      run: cargo check --target wasm32-unknown-unknown

  test-msrv:
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Install toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: 1.32.0
        profile: minimal
        override: true

    - name: Run tests
      run: cargo test