rust_lib_example 0.2.0

Rust project example
Documentation
name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

env:
  CARGO_TERM_COLOR: always
  RUST_VERSION_STABLE: 1.51.0
  RUST_VERSION_NIGHTLY: nightly-2021-03-25
  MUTAGEN_COMMIT: f8249256c40769c916b5b00bd284f204d5540588
  COV_THRESHOLD: 100.0
  MUTAGEN_THRESHOLD: 100.0
  CRATE_PATHS: .

jobs:

  test:
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_VERSION_STABLE }}
          profile: minimal
          override: true
      - name: Build
        run: cargo build --all-targets
      - name: Test
        run: cargo test

  check-coverage:
    runs-on: ubuntu-18.04
    needs: test
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_VERSION_NIGHTLY }}
          profile: minimal
          components: llvm-tools-preview
          override: true
      - name: Install grcov
        run: cargo install grcov --debug
      - name: Run coverage
        run: bash .github/workflows/scripts/run_coverage.sh
      - name: Upload coverage report on GitHub
        uses: actions/upload-artifact@v2
        with:
          name: coverage
          path: coverage
          if-no-files-found: error
          retention-days: 1
      - name: Upload coverage report on Codecov
        run: bash .github/workflows/scripts/upload_coverage_on_codecov.sh
      - name: Check coverage threshold
        run: bash .github/workflows/scripts/check_coverage.sh

  check-mutations:
    runs-on: ubuntu-18.04
    needs: test
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_VERSION_NIGHTLY }}
          profile: minimal
          override: true
      - name: Install mutagen
        run: bash .github/workflows/scripts/install_mutagen.sh
      - name: Run mutation tests
        run: bash .github/workflows/scripts/check_mutations.sh

  lint-rust:
    runs-on: ubuntu-18.04
    needs: test
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_VERSION_STABLE }}
          profile: minimal
          components: rustfmt, clippy
          override: true
      - name: Run clippy
        run: cargo clippy --all-targets -- -D warnings $(cat .lints | cut -f1 -d"#" | tr '\n' ' ')
      - name: Run rustfmt
        run: cargo fmt -- --check
      - name: Run cargo-deny
        uses: EmbarkStudios/cargo-deny-action@v1

  lint-generic:
    runs-on: ubuntu-18.04
    needs: test
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install other dependencies
        run: sudo apt-get install moreutils dos2unix
      - name: Check encoding
        run: isutf8 **/*
      - name: Check line endings
        run: bash .github/workflows/scripts/check_line_endings.sh
      - name: Check TODOs
        run: bash .github/workflows/scripts/check_todos.sh