Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[run]
branch = True
source = .
omit =
*/migrations/*
*/__init__.py
*/tests.py
*/test_*.py
manage.py
*/wsgi.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
if TYPE_CHECKING:
@abstractmethod
@abc.abstractmethod
@property
if settings.DEBUG

ignore_errors = True

[html]
directory = htmlcov

[xml]
output = coverage.xml
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

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

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_valence
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_valence
DJANGO_SETTINGS_MODULE: cognitiveAffectiveMaps.settings_local
SECRET_KEY: test-secret-key-for-ci
DEBUG: False

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest-cov coverage
pip install -r requirements.txt

- name: Run migrations
run: |
python manage.py migrate --noinput

- name: Run tests with coverage
run: |
pytest --cov --cov-report=xml --cov-report=term --cov-report=html

- name: Check coverage threshold
run: |
coverage report --fail-under=60

- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: always()
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Upload coverage HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: htmlcov/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
Loading
Loading