rpdelaney/dumbpw

View on GitHub
.github/workflows/coverage.yaml

Summary

Maintainability
Test Coverage
---
name: Coverage

on:
  pull_request:
  push:
    branches: [main]
    paths:
      - dumbpw/**
      - tests/**
      - .coveragerc
      - .github/workflows/coverage.yaml

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      # ----------------------------------------------
      # check-out repo and set-up python
      # ----------------------------------------------
      - name: Check out repository
        uses: actions/checkout@v2.5.0
      - name: Set up python ${{ matrix.python-version }}
        id: setup-python
        uses: actions/setup-python@v4.3.0
        with:
          python-version: ${{ matrix.python-version }}

      # ----------------------------------------------
      # build virtual environment and install
      # ----------------------------------------------
      - name: Install Poetry
        uses: snok/install-poetry@v1.3.3
        with:
          virtualenvs-create: true
          virtualenvs-in-project: true
          installer-parallel: true
      - name: Load cached venv
        id: cached-poetry-dependencies
        uses: actions/cache@v3.0.11
        with:
          path: .venv
          key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
      - name: Install dependencies if cached venv not found
        if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
        run: poetry install --no-interaction --no-root
      - name: Install module
        run: poetry install --no-interaction

      # ----------------------------------------------
      # publish coverage report
      # ----------------------------------------------
      - name: Publish coverage report
        uses: paambaati/codeclimate-action@v3.2.0
        env:
          CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
        with:
          coverageCommand: poetry run pytest --cov-report xml
          coverageLocations: ${{github.workspace}}/cov/coverage.xml:coverage.py