rualdi 0.2.3

Rust Aliasing Directory
name: Main workflow
on:
  push:
    paths-ignore:
      - "**.md"
  pull_request:
    paths-ignore:
      - "**.md"

jobs:
  # Run the `rustfmt` code formatter
  rustfmt:
    name: Rustfmt [Formatter]
    runs-on: ubuntu-latest
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          components: rustfmt
          override: true

      - name: Build | Format
        run: cargo fmt --all -- --check

  # Run the `clippy` linting tool
  clippy:
    name: Clippy [Linter]
    strategy:
      matrix:
        os: [ubuntu-latest, macOS-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

      # Workaround for restoring cache from action/cache getting corrupted for macOS
      - name: Install GNU tar
        if: runner.os == 'macOS'
        run: |
          brew install gnu-tar
          echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH

      # Cache files between builds
      - name: Setup | Cache Cargo
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
          profile: minimal
          components: clippy

      - name: Build | Lint
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all-targets --all-features -- -D clippy::all

  # Ensure that the project could be successfully compiled
  check:
    name: Compile
    runs-on: ubuntu-latest
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

      # Cache files between builds
      - name: Setup | Cache Cargo
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Build | Check
        run: cargo check --all

  # Run tests on Linux, and macOS
  # On both Rust stable and Rust nightly
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    needs: check # First check then run expansive tests
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macOS-latest]
        rust: [stable, nightly]
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v2

      # Workaround for restoring cache from action/cache getting corrupted for macOS
      - name: Install GNU tar
        if: runner.os == 'macOS'
        run: |
          brew install gnu-tar
          echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH

      # Cache files between builds
      - name: Setup | Cache Cargo
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-${{ matrix.rust }}-fixed-cargo-${{ hashFiles('**/Cargo.lock') }}

      # Install all the required dependencies for testing
      - name: Setup | Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          override: true

      - name: Build | Test rualdi
        run: cargo test -- --test-threads=1

      - name: Build | Test rualdlib
        run: cd rualdlib && cargo test