hermod-api 0.1.2

Rapid and seamless customer interaction, designed for CS 495 at The University of Alabama.
Documentation
name: Coverage

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  coverage:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: password
          POSTGRES_DB: postgres
        ports:
          - 5432:5432
    env:
      DATABASE_URL: postgres://postgres:password@localhost:5432/hermod
      SQLX_VERSION: 0.5.7
      SQLX_FEATURES: postgres
    steps:
      - uses: actions/checkout@v2
      - name: Cache dependencies
        id: cache-dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ./target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-cover
      - name: Install Rust
        run: rustup toolchain install nightly --component llvm-tools-preview
      - name: Cache sqlx-cli
        uses: actions/cache@v2
        id: cache-sqlx
        with:
          path: |
            ~/.cargo/bin/sqlx
          key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}-cover
      - name: Install sqlx-cli
        uses: actions-rs/cargo@v1
        if: steps.cache-sqlx.outputs.cache-hit == false
        with:
          command: install
          args: >
            sqlx-cli
            --force
            --version=${{ env.SQLX_VERSION }}
            --features=${{ env.SQLX_FEATURES }}
      - name: Install cargo-llvm-cov
        run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
      - name: Migrate database
        run: |
          sudo apt-get install libpq-dev -y
          SKIP_DOCKER=true ./scripts/init_db.sh
      - name: Generate code coverage
        run: cargo llvm-cov --all-features --ignore-filename-regex "build.rs|src\/main.rs" --workspace --lcov --output-path lcov.info
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1
        with:
          files: lcov.info
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}