grup 0.2.3

an offline github markdown previewer
on:
  push:
  pull_request:
  schedule:
  # run at least once a month
    - cron: "* * 15 * *"
# based on actions-rs msrv example
# https://github.com/actions-rs/example/blob/23ffb1bf0016f41999902ba7542b4f1bb1a89c48/.github/workflows/msrv.yml

name: Check rustfmt, run tests, clippy & dependency audit
jobs:
  test:
    name: Run Test Suite on Linux, Windows & MacOs
    # run on latest ubuntu, macos, windows
    strategy:
      matrix:
        rust:
          - stable
          - nightly
        platform:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - uses: actions-rs/cargo@v1
        with:
          command: test

# run rustfmt only on linux with stable toolchain as behaviour of rustfmt should be same across OSes
  fmt:
    name: Check if Code is RustFmt'ed
    strategy:
      matrix:
        rust:
          - stable
        platform:
          - ubuntu-latest
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - run: rustup component add rustfmt
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

  clippy:
    name: Run Clippy on ubuntu with stable toolchain & only log warnings (no failures)
    strategy:
      matrix:
        rust:
          - stable
        platform:
          - ubuntu-latest
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - run: rustup component add clippy
      - uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --
  
  security_audit:
    name: Security audit the cargo dependencies on ubuntu with stable toolchain
    strategy:
      matrix:
        rust:
          - stable
        platform:
          - ubuntu-latest
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}