Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Coverage configuration for Games XBlock
# Following Open edX standards

[run]
branch = True
source = games
omit =
*/migrations/*
*/tests/*
*/test_*.py
*/__pycache__/*
*/locale/*
tests/settings.py
tests/urls.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code
def __repr__
def __str__

# Don't complain if tests don't hit defensive assertion code
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run
if 0:
if False:
if __name__ == .__main__.:

# Don't complain about abstract methods
@abstract

ignore_errors = True
precision = 2

[html]
directory = htmlcov

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

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
django-version: ['3.2', '4.2']

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

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext

- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel

- name: Install package dependencies
run: pip install -e .

- name: Install Django ${{ matrix.django-version }}
run: pip install "Django~=${{ matrix.django-version }}.0"

- name: Install test requirements
run: pip install -r requirements/ci.txt

- name: Run tests with coverage
run: |
pytest tests/ -v --cov=games --cov-report=term-missing --cov-report=xml --cov-report=html --cov-fail-under=80

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}-django-${{ matrix.django-version }}
path: htmlcov/
retention-days: 30

quality:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r test-requirements.txt

- name: Run quality checks
run: make quality
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
__pycache__

*.lcov

.venv/
*.pyc

# Build and distribution files
*.egg-info/
dist/
build/
.DS_Store
.DS_Store

# Test and coverage files
coverage.xml
.coverage
htmlcov/
.pytest_cache/
.tox/
*.cover
.hypothesis/
Loading