mit-commit 1.29.8

For building commit linters. This makes it eas.
Documentation
name: Test
on:
  push:
    branches:
      - "*"
  pull_request:
jobs:
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        name: Checkout the repository
      - uses: actions/cache@v2.1.6
        name: Cache cargo
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/audit-check@v1.2.0
        name: Audit check cargo packages
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
  version:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0
      - uses: chaaz/versio-actions/install@v1.1
        name: Install versio
      - name: Check projects
        run: versio check
      - name: Print changes
        run: versio plan
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_USER: ${{ github.actor }}
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: check
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
    steps:
      - run: ${{ matrix.install }}
        env:
          DEBIAN_FRONTEND: noninteractive
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: test
  bench:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: bench
  lints:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          profile: minimal
          toolchain: stable
          default: true
          components: rustfmt, clippy
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: fmt
          args: --all -- --check
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: clippy
          args:
            --all-targets --all-features -- -D warnings -Dclippy::all -D clippy::pedantic
            -D clippy::cargo
      - name: Prettify code
        uses: creyD/prettier_action@v3.3
        with:
          prettier_options: --check **/*.{yml,yaml}
  publish-to-cargo:
    if:
      "github.ref == 'refs/heads/main' && contains(github.event.head_commit.message,\
      \ 'build(deploy): Versio update versions')"
    needs:
      - version
      - test
      - lints
      - check
      - security-audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        with:
          token: ${{ secrets.COMMITTER_TOKEN }}
          fetch-depth: 0
      - uses: actions-rs/cargo@v1.0.3
        name: Install TOML Reader
        with:
          command: install
          args: toml-cli
      - id: get_version
        name: Calculate current version number
        run:
          echo ::set-output name=VERSION::$(toml get Cargo.toml package.version |
          tail -c +2 | head -c -2)
        shell: bash
      - id: get_cargo_version
        name: Calculate cargo version number
        run:
          echo ::set-output name=VERSION::$(cargo search serde | sed -r "s/.* = \"([0-9].*)\"
          +#.*/\1/g" |  head -n 1)
      - env:
          CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
        if:
          ${{ steps.get_version.outputs.VERSION != steps.get_cargo_version.outputs.VERSION
          }}
        run: |
          cargo login "$CARGO_TOKEN"
          cargo publish
  merge-and-push:
    if: github.ref == 'refs/heads/main'
    needs:
      - version
      - test
      - lints
      - check
      - security-audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        with:
          token: ${{ secrets.COMMITTER_TOKEN }}
          fetch-depth: 0
      - uses: chaaz/versio-actions/install@v1.1
        name: Install versio
      - run: echo ::set-output "name=BUMP::$( versio release --dry-run )"
        id: get_versio_plan
        env:
          GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
          GITHUB_USER: ${{ github.actor }}
      - name: Generate release
        if: ${{ contains(steps.get_versio_plan.outputs.BUMP, ' -> ') }}
        run: versio release
        env:
          GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
          GITHUB_USER: ${{ github.actor }}