Skip to content

Merge pull request #632 from WesternFriend/refactor-design-patterns #76

Merge pull request #632 from WesternFriend/refactor-design-patterns

Merge pull request #632 from WesternFriend/refactor-design-patterns #76

Workflow file for this run

name: CodeCov
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
runner-job:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@master
with:
python-version: 3.11
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./app/.venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
working-directory: ./app
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# Run tests, generate and upload code coverage report
#----------------------------------------------
- name: Generate Report
working-directory: ./app
run: |
poetry run coverage run manage.py test
poetry run coverage xml
- name: Codecov action
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./app/coverage.xml
- uses: paambaati/codeclimate-action@v4.0.0
env:
CC_TEST_REPORTER_ID: 15a71e71a294b41066a953a4ad40a936918f4e34dc5824cc558b26174962702d
with:
coverageLocations: |
${{github.workspace}}/app/coverage.xml:coverage.py