name: Default-Workflow

on: [push, pull_request, workflow_dispatch]

env:
  CARGO_TERM_COLOR: always

jobs:
  checkout:
    runs-on: self-hosted

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

    - name: Display installed toolchains
      run:  rustup +stable show; rustup +nightly show

    - name: Cargo dependency update
      run:  cargo update
      

  stable:
    runs-on: self-hosted
    needs: checkout

    steps:
    - name: Build debug target
      run:  cargo +stable build --verbose

    - name: Lint via `clippy`
      run:  cargo +stable clean; cargo +stable clippy

    - name: Unit Tests
      run: cargo +stable test


  nightly:
    runs-on: self-hosted
    needs: checkout

    steps:
    - name: Build debug target
      run:  cargo +nightly build --verbose

    - name: Lint via `clippy`
      run:  cargo +nightly clean; cargo +nightly clippy

    - name: Unit Tests
      run: cargo +nightly test

    - name: Formatting Check
      run: cargo +nightly fmt -- --check