Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Setup coverage #30

Merged
merged 9 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[run]
source = ./src/
omit =
*/.venv/*
*/migrations/*
*/tests/*

[report]
fail_under = 60
include = *.py
show_missing = True
skip_covered = True
19 changes: 12 additions & 7 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Codecov

on:
push:
branches:
Expand All @@ -16,26 +17,30 @@ jobs:
env:
OS: ${{ matrix.os }}
PYTHON: '3.8'
PIPENV_VENV_IN_PROJECT: 1
SECRET_KEY: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.7
python-version: 3.8
- name: Generate coverage report
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
cp contrib/env-sample ./.env
python -m pip install pipenv
pipenv --python 3.8
pipenv sync
pipenv sync --dev
pipenv run coverage run src/manage.py test
pipenv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
files: ./coverage1.xml,./coverage2.xml
directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.gz
path_to_write_report: ./coverage.xml
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ autopep8 = "*"
pylint = "*"
jupyter = "*"
comlipy = "*"
coverage = "*"

[packages]
django = "*"
Expand Down
42 changes: 41 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions contrib/env-sample
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
SECRET_KEY=YOUR_SECRET_HERE
DEBUG=False
DEBUG=True
ALLOWED_HOSTS=127.0.0.1,localhost
LANGUAGE_CODE=pt-BR
TIME_ZONE=America/Sao_Paulo
DATABASE_URL=postgres://user:password@localhost:port/dbname
CELERY_BROKER_URL='redis://localhost:6379'
EMAIL_HOST=hosthere
DATABASE_URL=postgres://postgres:supersecretpassword@db:5432/gestao
CELERY_BROKER_URL='redis://redis:6379'
EMAIL_HOST=""
EMAIL_PORT=587
EMAIL_HOST_USER=emailhere
EMAIL_HOST_PASSWORD=passhere
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
EMAIL_USE_TLS=True
EMAIL_USE_SSL=False
POSTGRES_DB=gestao
POSTGRES_USER=postgres
POSTGRES_PASSWORD=supersecretpassword
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ services:
command: >
celery -A gestao_rh worker -l info -B --scheduler django_celery_beat.schedulers:DatabaseScheduler
depends_on:
- redis
- app_gestao

db:
image: postgres:latest
environment:
POSTGRES_DB: "${DBNAME}"
POSTGRES_USER: "${DBUSER}"
POSTGRES_PASSWORD: "${DBPASSWORD}"
env_file:
- ./.env
ports:
- "5432:5432"
volumes:
Expand Down