From 99e251cced8b4d579e852ff913c12ac3126f6f6d Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Fri, 29 Mar 2024 13:39:10 +0100 Subject: [PATCH] Add code coverage analysis by Codecov (#92) --- .github/workflows/pytest.yml | 18 ++++++++++++++++-- .gitignore | 4 ++-- README.md | 3 ++- environment.yml | 3 ++- environment_ace.yml | 3 ++- environment_mace.yml | 3 ++- pyproject.toml | 3 +++ 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 92100d12..08386128 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -38,7 +38,14 @@ jobs: run: ./install_gap.sh - name: Test basic install - run: pytest + run: pytest --cov + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + flags: python-${{ matrix.python-version }} + token: ${{ secrets.CODECOV_TOKEN }} + slug: duartegroup/mlp-train test-mace: @@ -70,4 +77,11 @@ jobs: run: ./install_mace.sh - name: Test MACE install - run: pytest + run: pytest --cov + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + flags: python-${{ matrix.python-version }}-mace + token: ${{ secrets.CODECOV_TOKEN }} + slug: duartegroup/mlp-train diff --git a/.gitignore b/.gitignore index 4ba3241d..42e886fd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ dist/ *DS_store **/__pycache__/ **/__MACOSX/ -.coverage -.pytest_cache \ No newline at end of file +.coverage* +.pytest_cache diff --git a/README.md b/README.md index 60a20ecf..31b2aca7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Test with pytest](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml/badge.svg?event=push)](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml) +[![pytest CI](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml/badge.svg?event=push)](https://github.com/duartegroup/mlp-train/actions/workflows/pytest.yml) +[![codecov](https://codecov.io/gh/duartegroup/mlp-train/branch/main/graph/badge.svg)](https://codecov.io/gh/duartegroup/mlp-train) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![License](https://img.shields.io/badge/License-MIT%202.0-blue.svg)](https://opensource.org/licenses/mit) diff --git a/environment.yml b/environment.yml index c1b37a44..ca43fd1d 100644 --- a/environment.yml +++ b/environment.yml @@ -14,7 +14,8 @@ dependencies: - dscribe=2.0 - matplotlib-base - numpy - - pytest + - pytest=8 + - pytest-cov=5 - py-plumed - scipy - xtb diff --git a/environment_ace.yml b/environment_ace.yml index e6ff624e..992c3383 100644 --- a/environment_ace.yml +++ b/environment_ace.yml @@ -14,7 +14,8 @@ dependencies: - dscribe=2.0 - matplotlib-base - numpy - - pytest + - pytest=8 + - pytest-cov=5 - py-plumed - scipy - xtb diff --git a/environment_mace.yml b/environment_mace.yml index aaac7b78..515fc635 100644 --- a/environment_mace.yml +++ b/environment_mace.yml @@ -15,7 +15,8 @@ dependencies: - dscribe=2.0 - matplotlib-base - numpy - - pytest + - pytest=8 + - pytest-cov=5 - py-plumed - scipy - xtb diff --git a/pyproject.toml b/pyproject.toml index 02b85a3a..00591d84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,6 @@ line-length = 79 [tool.ruff.format] quote-style = "single" + +[tool.pytest.ini_options] +addopts = "--cov-report term --cov-report xml"