matejak/estimagus

View on GitHub
.github/workflows/gating.yml

Summary

Maintainability
Test Coverage
name: Gating
on:
  push:
    branches: [ 'main' ]
  pull_request:
    branches: [ 'main' ]
jobs:
  validate-ubuntu:
    name: Build, Test on Ubuntu 22.04
    runs-on: ubuntu-22.04
    steps:
      - name: Install Deps
        uses: mstksg/get-package@master
        with:
          apt-get: python3
            python3-flask python3-flaskext.wtf python3-flask-login
            python3-scipy python3-matplotlib
            python3-jira
            python3-pytest python3-pip

      - name: Checkout
        uses: actions/checkout@v2

      - name: "Set git safe directory, ref: https://github.com/actions/checkout/issues/760"
        run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

      - name: Install deps python
        run: pip3 install -r "$GITHUB_WORKSPACE/requirements.txt.in" pytest-dependency pytest-cov

      - name: Test and collect coverage
        run: coverage run --source estimage -m pytest

      - name: Produce coverage report of relevant files
        run: coverage xml --omit '*/webapp/*,*/routes.py,*/forms.py,*/visualize/*'

      - name: Upload coverage to Code Climate  # Requires: git package
        if: ${{ github.repository == 'matejak/estimagus' }}
        uses: paambaati/codeclimate-action@v3.0.0
        env:
          CC_TEST_REPORTER_ID: 707f3c07eac4f6e1a4d961cdf41db8ef2d1482bb0560489dc9999217af184368
        with:
          coverageLocations: coverage.xml:coverage.py