diff --git a/.github/workflows/code_changes.yaml b/.github/workflows/code_changes.yaml index 2bd433a49..21c6815b1 100644 --- a/.github/workflows/code_changes.yaml +++ b/.github/workflows/code_changes.yaml @@ -46,7 +46,13 @@ jobs: run: uv pip install policyengine --system - name: UV sync run: uv sync - - name: Run tests + - name: Run tests with coverage run: make test env: HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml + fail_ci_if_error: false + verbose: true diff --git a/.github/workflows/pr_code_changes.yaml b/.github/workflows/pr_code_changes.yaml index e63a4d908..ffac44323 100644 --- a/.github/workflows/pr_code_changes.yaml +++ b/.github/workflows/pr_code_changes.yaml @@ -46,9 +46,15 @@ jobs: run: uv pip install policyengine --system - name: UV sync run: uv sync - - name: Run tests + - name: Run tests with coverage run: make test env: HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml + fail_ci_if_error: false + verbose: true - name: Test documentation builds run: make documentation \ No newline at end of file diff --git a/.gitignore b/.gitignore index faa5fb1d7..ee7a5016f 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,28 @@ policyengine_uk/calibration/*.h5 *.ipynb !docs/**/*.ipynb !uprating_growth_factors.csv + +# Virtual environments +.venv/ +venv/ +env/ +ENV/ +.env +env.bak/ +venv.bak/ +.env* + +# Coverage / testing +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ diff --git a/Makefile b/Makefile index 5373978b8..33ddf37ab 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ format: test: policyengine-core test policyengine_uk/tests/policy -c policyengine_uk - pytest policyengine_uk/tests/ -v + pytest policyengine_uk/tests/ --cov=policyengine_uk --cov-report=xml --maxfail=0 -v update-tests: python policyengine_uk/data/economic_assumptions.py diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..60f5f8ea2 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,5 @@ +- bump: minor + changes: + added: + - Codecov coverage. + - Expanded .gitignore. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cc11300e8..f4ce4a955 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ dev = [ "furo<2023", "tqdm", "pytest", + "pytest-cov", "setuptools", "sphinx-argparse>=0.3.2,<1", "sphinx-math-dollar>=1.2.1,<2",