Skip to content

Merge pull request #39 from JoshuaMarden/dashboard_fix #152

Merge pull request #39 from JoshuaMarden/dashboard_fix

Merge pull request #39 from JoshuaMarden/dashboard_fix #152

name: Pytest Coverage
# Runs a coverage test and pushes the result to CodeCov.
# Reports are then generated by CodeCov
# and badges etc can be integrated into README.md.
on: [push, pull_request]
jobs:
run-tests-and-coverage:
name: Generate and Upload Coverage Report For CodeCov
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
export PYTHONPATH="$PYTHONPATH:$(pwd)"
source ./add_root_to_path.sh
- name: Install dependencies for Pytest-Cov
run: |
source venv/bin/activate
pip install --upgrade pip
pip install pytest-cov
pip install -r requirements.txt
- name: Run tests with coverage
run: |
source venv/bin/activate
pytest --cov=./ --cov-report=xml:coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: pytest
name: pytest-coverage-report
fail_ci_if_error: true