SforAiDl/genrl

View on GitHub
.github/workflows/codecov.yml

Summary

Maintainability
Test Coverage
name: Code Coverage

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
           
    steps:
      # Caching Linux
      - uses: actions/cache@v2
        if: startsWith(runner.os, 'Linux')
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      # Setup
      - uses: actions/checkout@v2
      - name: Set up Python 3.7
        uses: actions/setup-python@v2
        with:
          python-version: 3.7

      # Install Dependencies
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest-cov codecov
          if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

      - name: Tests
        run: pytest --cov-report xml --cov='./genrl/' --cov-config=.coveragerc

      - name: Code Coverage Report
        uses: codecov/codecov-action@v1
        if: always()
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: false
          file: coverage.xml
          env_vars: OS,PYTHON