From c5918d6a754adc08a026b2a3a2781b541f656f54 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 11:13:26 +0100 Subject: [PATCH 1/9] Add pypi badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9379f692..2b6b80fa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # SWMManywhere: Synthesise Urban Drainage Network Models Anywhere in the World +[![PyPI version shields.io](https://img.shields.io/pypi/v/swmmanywhere.svg)](https://pypi.python.org/pypi/swmmanywhere/) [![Test and build](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml/badge.svg)](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml) [![DOI](https://zenodo.org/badge/741903266.svg)](https://zenodo.org/doi/10.5281/zenodo.13837741) From 5350c43e160d8a7610ab798a522817d02c1d8bb1 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 11:41:16 +0100 Subject: [PATCH 2/9] Add codecov workflow --- .github/workflows/ci_template.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_template.yml b/.github/workflows/ci_template.yml index f9e87d29..9383d107 100644 --- a/.github/workflows/ci_template.yml +++ b/.github/workflows/ci_template.yml @@ -25,7 +25,21 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: pip install .[dev] + - name: Run tests - run: pytest \ No newline at end of file + run: pytest --junitxml=junit/pytest.xml \ + --cov=swmmanywhere \ + --cov-branch \ + --cov-report=xml + + - name: Upload coverage to Codecov + if: success() && (github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + files: ./coverage.xml + verbose: true \ No newline at end of file From 89af386b6f3a8b8dbf1b141e213896f63b474f26 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 12:00:33 +0100 Subject: [PATCH 3/9] Fix codecov workflow --- .github/workflows/ci_template.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_template.yml b/.github/workflows/ci_template.yml index 9383d107..e0c72ef2 100644 --- a/.github/workflows/ci_template.yml +++ b/.github/workflows/ci_template.yml @@ -31,7 +31,7 @@ jobs: - name: Run tests run: pytest --junitxml=junit/pytest.xml \ - --cov=swmmanywhere \ + --cov=src/swmmanywhere \ --cov-branch \ --cov-report=xml @@ -39,7 +39,6 @@ jobs: if: success() && (github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - files: ./coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} verbose: true \ No newline at end of file From 0816dab825438d2f01267bb32e538e95a9cd320c Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 12:26:33 +0100 Subject: [PATCH 4/9] Revert workflow addition --- .github/workflows/ci_template.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci_template.yml b/.github/workflows/ci_template.yml index e0c72ef2..90e4a3bd 100644 --- a/.github/workflows/ci_template.yml +++ b/.github/workflows/ci_template.yml @@ -30,10 +30,7 @@ jobs: run: pip install .[dev] - name: Run tests - run: pytest --junitxml=junit/pytest.xml \ - --cov=src/swmmanywhere \ - --cov-branch \ - --cov-report=xml + run: pytest - name: Upload coverage to Codecov if: success() && (github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') From 5bd4c1738b4ef945162ccddd46689eaf8bbc4f69 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 12:35:39 +0100 Subject: [PATCH 5/9] Change conditions for codecov workflow --- .github/workflows/ci_template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_template.yml b/.github/workflows/ci_template.yml index 90e4a3bd..9618ea42 100644 --- a/.github/workflows/ci_template.yml +++ b/.github/workflows/ci_template.yml @@ -33,9 +33,9 @@ jobs: run: pytest - name: Upload coverage to Codecov - if: success() && (github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') + if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') uses: codecov/codecov-action@v4 with: - fail_ci_if_error: false + fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} verbose: true \ No newline at end of file From 79da7de7a2445cb7cbc85b64aa0ed74a35620002 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 13:02:36 +0100 Subject: [PATCH 6/9] Add coverage report to docs --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index c561e5fd..e65a9170 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,4 +61,4 @@ nav: - Post processing: reference-post-processing.md - Preprocessing: reference-preprocessing.md - Config definitions: reference-defs.md - - Coverage report: coverage.md \ No newline at end of file + - Coverage report: https://app.codecov.io/gh/ImperialCollegeLondon/SWMManywhere \ No newline at end of file From 7810a65b0ffa85c70224f54e3531fd9a835bb442 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 13:47:07 +0100 Subject: [PATCH 7/9] Switch coverage report to xml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 66ca600e..8acf24f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,7 @@ skip = "src/swmmanywhere/defs/iso_converter.yml,*.inp" ignore-words-list = "gage,gages" [tool.pytest.ini_options] -addopts = "-v --cov=src/swmmanywhere --cov-report=html --doctest-modules --ignore=src/swmmanywhere/logging.py" +addopts = "-v --cov=src/swmmanywhere --cov-report=xml --doctest-modules --ignore=src/swmmanywhere/logging.py" markers = [ "downloads: mark a test as requiring downloads", ] From e8772f25257e7801257c5dad3713e1f2da7080e9 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 14:44:13 +0100 Subject: [PATCH 8/9] Remove mkdocs-coverage plugin --- mkdocs.yml | 3 --- pyproject.toml | 1 - 2 files changed, 4 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index e65a9170..7d02f737 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -17,9 +17,6 @@ plugins: - mkdocs-jupyter: execute: false - search - - coverage: - page_name: coverage # default - html_report_dir: htmlcov # default - include-markdown repo_url: https://github.com/ImperialCollegeLondon/SWMManywhere diff --git a/pyproject.toml b/pyproject.toml index 8acf24f5..9d950f89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,6 @@ optional-dependencies.dev = [ ] optional-dependencies.doc = [ "mkdocs", - "mkdocs-coverage", "mkdocs-include-markdown-plugin", "mkdocs-jupyter", "mkdocs-material", From faf07b72d2e96449e865677097c26a8333846d8a Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 1 Oct 2024 14:54:43 +0100 Subject: [PATCH 9/9] Add codecov badge to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2b6b80fa..e54b3333 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![PyPI version shields.io](https://img.shields.io/pypi/v/swmmanywhere.svg)](https://pypi.python.org/pypi/swmmanywhere/) [![Test and build](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml/badge.svg)](https://github.com/ImperialCollegeLondon/SWMManywhere/actions/workflows/ci.yml) [![DOI](https://zenodo.org/badge/741903266.svg)](https://zenodo.org/doi/10.5281/zenodo.13837741) +[![codecov](https://codecov.io/gh/ImperialCollegeLondon/SWMManywhere/graph/badge.svg)](https://codecov.io/gh/ImperialCollegeLondon/SWMManywhere) SWMManywhere is a tool to synthesise urban drainage network models (UDMs) using