diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..71c0278 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,37 @@ +# .coveragerc to control coverage.py +[run] +branch = False +source = dqmc + +[report] +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about debug-only code and print statements: + def __repr__ + def __str__ + + # Don't complain about abstract methods + @abstract + @njit + + # 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 __name__ == .__main__.: + +ignore_errors = True + +# Skip source files: +omit = + dqmc/tests/* + dqmc/__init__.py + dqmc/__main__.py + dqmc/mfuncs.py + dqmc/data.py + dqmc/logging.py + dqmc/_version.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8cb49e..7f99dab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,11 +41,18 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install pytest pytest-cov codecov + pip install -r requirements.txt - name: Build Fortran source code run: | make - - name: Run all tests + - name: Run tests run: | - pytest dqmc/ + pytest dqmc/ --cov=dqmc --cov-report=xml -v + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + env_vars: OS,PYTHON + verbose: True + - name: Coverage + run: codecov diff --git a/README.md b/README.md index 4c85287..f2f3bdc 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/dylanljones/dqmc) ![GitHub license](https://img.shields.io/github/license/dylanljones/dqmc) -| | | | -|:-------|:-------------------------------------|:--------------------------------------| -| Master | [![Build][build-master]][build-link] | [![Tests][tests-master]][test-link] | -| Dev | [![Build][build-dev]][build-link] | [![Tests][tests-dev]][test-link] | +| | | | | +|:-------|:-------------------------------------|:--------------------------------------|:--------------------------------------------------| +| Master | [![Build][build-master]][build-link] | [![Tests][tests-master]][test-link] | [![Codecov][codecov-master]][codecov-master-link] | +| Dev | [![Build][build-dev]][build-link] | [![Tests][tests-dev]][test-link] | [![Codecov][codecov-dev]][codecov-dev-link] | [build-master]: https://img.shields.io/github/workflow/status/dylanljones/dqmc/Build/master?label=build&logo=github&style=flat-square [build-dev]: https://img.shields.io/github/workflow/status/dylanljones/dqmc/Build/dev?label=build&logo=github&style=flat-square @@ -16,6 +16,11 @@ [tests-dev]: https://img.shields.io/github/workflow/status/dylanljones/dqmc/Tests/dev?label=tests&logo=github&style=flat-square [test-link]: https://github.com/dylanljones/dqmc/actions/workflows/test.yml +[codecov-master]: https://img.shields.io/codecov/c/github/dylanljones/dqmc/master?logo=codecov&style=flat-square +[codecov-master-link]: https://app.codecov.io/gh/dylanljones/dqmc/branch/master +[codecov-dev]: https://img.shields.io/codecov/c/github/dylanljones/dqmc/dev?logo=codecov&style=flat-square +[codecov-dev-link]: https://app.codecov.io/gh/dylanljones/dqmc/branch/dev + Efficient and stable Determinant Quantum Monte Carlo (DQMC) simulations of the Hubbard model in Python. | :warning: **WARNING**: This project is still in development and might contain errors or change significantly in the future! |