misc_utils 4.0.1

A small collection of convenient and utility functions developed for personal use.
Documentation
name: Rust CI
on:
  # Always test pull requests
  pull_request:
  # Bors related branches
  push:
    branches:
      - master
      - staging
      - trying
  # Run every Saturday night
  schedule:
    - cron: "0 4 * * 6"

env:
  CARGO_INCREMENTAL: 0
  RUSTFLAGS: -D warnings

jobs:
  clippy_check:
    strategy:
      fail-fast: false
      matrix:
        os: ["ubuntu-latest", "windows-latest"]
        rust: ["stable"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: clippy
      - uses: actions-rs/clippy-check@v1
        name: clippy "No Default Features" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --workspace --no-default-features -- -D warnings
          name: clippy "No Default Features" (${{ matrix.os }} / ${{ matrix.rust }})
      - uses: actions-rs/clippy-check@v1
        name: clippy "Default" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --workspace -- -D warnings
          name: clippy "Default" (${{ matrix.os }} / ${{ matrix.rust }})
      - uses: actions-rs/clippy-check@v1
        name: clippy "All Features" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --workspace --all-features -- -D warnings
          name: clippy "All Features" (${{ matrix.os }} / ${{ matrix.rust }})

  rustfmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          components: rustfmt
      - uses: actions-rs/cargo@v1
        name: Rustfmt Check (${{ matrix.rust }})
        with:
          command: fmt
          args: --all -- --check

  build_and_test:
    name: Build and Test
    strategy:
      matrix:
        os: ["ubuntu-latest", "windows-latest"]
        rust: ["stable", "nightly"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - uses: actions-rs/cargo@v1
        name: Build (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          command: build
          args: --all --all-features
      - uses: actions-rs/cargo@v1
        name: Test "No Default Features" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          command: test
          args: --all --no-default-features
      - uses: actions-rs/cargo@v1
        name: Test "Default" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          command: test
          args: --all
      - uses: actions-rs/cargo@v1
        name: Test "All Features" (${{ matrix.os }} / ${{ matrix.rust }})
        with:
          command: test
          args: --all --all-features

  # Added to summarize the matrix (otherwise we would need to list every single
  # job in bors.toml)
  # https://forum.bors.tech/t/bors-with-github-workflows/426
  tests-result:
    name: Tests result
    if: always()
    needs:
      - rustfmt
      - clippy_check
      - build_and_test
    runs-on: ubuntu-latest
    steps:
      - name: Mark the job as a success
        if: "needs.rustfmt.result == 'success' && needs.clippy_check.result == 'success' && needs.build_and_test.result == 'success'"
        run: exit 0
      - name: Mark the job as a failure
        if: "!(needs.rustfmt.result == 'success' && needs.clippy_check.result == 'success' && needs.build_and_test.result == 'success')"
        run: exit 1