From e6c704841a55025c3f5766ca7703fff646b25b30 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 18:40:23 +0100 Subject: [PATCH 1/4] Tests: Report code coverage --- .github/workflows/tests.yml | 11 +++++++++++ .gitignore | 2 ++ pyproject.toml | 15 ++++++++++++++- setup.py | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 57f07a6..df3f19d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,3 +56,14 @@ jobs: - name: Run tests run: | make test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: ./coverage.xml + flags: unittests + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: true diff --git a/.gitignore b/.gitignore index 0c83f61..e48c9a9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /.venv* /var /dist +.coverage +coverage.xml diff --git a/pyproject.toml b/pyproject.toml index 7b9d18a..3c81f6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,10 @@ profile = "black" src_paths = ["grafana_wtf", "tests"] [tool.pytest.ini_options] -addopts = "-ra -q --verbosity=3 --doctest-modules" +addopts = """ + -ra -q --verbosity=3 --doctest-modules + --cov --cov-report=term-missing --cov-report=xml +""" minversion = "2.0" log_level = "DEBUG" log_cli_level = "DEBUG" @@ -15,3 +18,13 @@ testpaths = [ "tests", ] xfail_strict = true + +[tool.coverage.run] +branch = false +source = ["grafana_wtf"] + +[tool.coverage.report] +fail_under = 0 +show_missing = true +omit = [ +] diff --git a/setup.py b/setup.py index e251c81..9fc3cd1 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ extras = { "test": [ "pytest<9", + "pytest-cov<6", "lovely-pytest-docker<1", "grafanalib==0.7.0", ] From 448899df3d7ea1105c9dc34439c6d519ca873c6b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 18:40:55 +0100 Subject: [PATCH 2/4] Documentation: Adjust badges in README, GitHub changed the rST rendering --- README.rst | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 0bceddc..62ea8f4 100644 --- a/README.rst +++ b/README.rst @@ -1,30 +1,41 @@ -.. image:: https://github.com/panodata/grafana-wtf/actions/workflows/tests.yml/badge.svg +########### +grafana-wtf +########### + +| + +.. start-badges + +|ci-tests| |ci-coverage| |license| |pypi-downloads| +|python-versions| |status| |pypi-version| |grafana-versions| + +.. |ci-tests| image:: https://github.com/panodata/grafana-wtf/actions/workflows/tests.yml/badge.svg :target: https://github.com/panodata/grafana-wtf/actions/workflows/tests.yml -.. image:: https://img.shields.io/pypi/pyversions/grafana-wtf.svg +.. |ci-coverage| image:: https://codecov.io/gh/panodata/grafana-wtf/branch/main/graph/badge.svg + :target: https://codecov.io/gh/panodata/grafana-wtf + :alt: Test suite code coverage + +.. |python-versions| image:: https://img.shields.io/pypi/pyversions/grafana-wtf.svg :target: https://pypi.org/project/grafana-wtf/ -.. image:: https://img.shields.io/pypi/status/grafana-wtf.svg +.. |status| image:: https://img.shields.io/pypi/status/grafana-wtf.svg :target: https://pypi.org/project/grafana-wtf/ -.. image:: https://img.shields.io/pypi/v/grafana-wtf.svg +.. |pypi-version| image:: https://img.shields.io/pypi/v/grafana-wtf.svg :target: https://pypi.org/project/grafana-wtf/ -.. image:: https://static.pepy.tech/badge/grafana-wtf/month +.. |pypi-downloads| image:: https://static.pepy.tech/badge/grafana-wtf/month :target: https://pypi.org/project/grafana-wtf/ -.. image:: https://img.shields.io/pypi/l/grafana-wtf.svg +.. |license| image:: https://img.shields.io/pypi/l/grafana-wtf.svg :target: https://github.com/panodata/grafana-wtf/blob/main/LICENSE -.. image:: https://img.shields.io/badge/Grafana-6.x%20--%2010.x-blue.svg +.. |grafana-versions| image:: https://img.shields.io/badge/Grafana-6.x%20--%2010.x-blue.svg :target: https://github.com/grafana/grafana :alt: Supported Grafana versions -| - -########### -grafana-wtf -########### +.. end-badges ***** From 5b9ae36e614141313070c5ac7b7c1c2eb0ced4c5 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 18:43:15 +0100 Subject: [PATCH 3/4] Remove support for Python 3.7 --- .github/workflows/tests.yml | 2 +- CHANGES.rst | 1 + setup.py | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df3f19d..e4b26ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest" ] - python-version: [ "3.7", "3.11", "3.12" ] + python-version: [ "3.8", "3.12" ] grafana-version: [ "6.7.6", "7.5.17", "8.5.27", "9.5.18", "10.3.5", "10.4.1" ] env: diff --git a/CHANGES.rst b/CHANGES.rst index c3b2161..c53d8b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,7 @@ in progress - Dependencies: Updated to ``docopt-ng`` - Add subcommand ``explore permissions``. Thanks, @meyerder. - Added support for Python 3.12 +- Removed support for Python 3.7 2024-03-07 0.18.0 ================= diff --git a/setup.py b/setup.py index 9fc3cd1..c38ccbe 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,6 @@ requires = [ # Core "six", - 'dataclasses; python_version<"3.7"', "docopt-ng>=0.6.2,<0.10", "munch>=2.5.0,<5", "tqdm>=4.60.0,<5", @@ -63,7 +62,6 @@ "Operating System :: Unix", "Operating System :: MacOS", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From 2c3cc15756f9cc762d7310930561f0f61392fe7b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 18:47:00 +0100 Subject: [PATCH 4/4] CI: Stop building OCI images on each PR, to save resources --- .github/workflows/oci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index dd8a37f..9ac769d 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -15,8 +15,8 @@ on: push: tags: - '*.*.*' - pull_request: - branches: [ main ] + # pull_request: + # branches: [ main ] # Allow job to be triggered manually. workflow_dispatch: