From 8020a2de7c2fac6ad5009b788cc0c42d6403a663 Mon Sep 17 00:00:00 2001 From: msftcangoblowme Date: Mon, 8 Apr 2024 09:36:59 +0000 Subject: [PATCH] codecov integration - chore: add codecov config file and workflow - docs(README.rst): show codecov badge --- .github/workflows/test-coverage.yml | 83 +++++++++++++++++++++++++++++ CHANGES.rst | 10 +++- README.rst | 7 ++- codecov.yml | 10 ++++ docs/conf.py | 4 +- 5 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test-coverage.yml create mode 100644 codecov.yml diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml new file mode 100644 index 0000000..27b3329 --- /dev/null +++ b/.github/workflows/test-coverage.yml @@ -0,0 +1,83 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/msftcangoblowm/logging-strict/blob/master/NOTICE.txt +# +# https://github.com/codecov/codecov-action +# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect + +name: "Codecov" + +on: + push: + branches: + - master + - msftcangoblowm/* + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + +env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + COVERAGE_IGOR_VERBOSE: 1 + FORCE_COLOR: 1 # Get colored test output + +permissions: + contents: read + +concurrency: + group: >- + ${{ github.workflow }}-${{ github.ref_type }}- + ${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +jobs: + codecov: + name: "${{ matrix.python-version }} on ${{ matrix.os }}" + runs-on: "${{ matrix.os }}-latest" + # Don't run tests if the branch name includes "-notests" + if: "!contains(github.ref, '-notests')" + strategy: + matrix: + os: + - ubuntu + python-version: + - "3.9" + fail-fast: false + steps: + - name: "Check out the repo" + uses: "actions/checkout@v4" + - name: Set up Python ${{ matrix.python-version }} + uses: "actions/setup-python@v5" + with: + python-version: "${{ matrix.python-version }}" + allow-prereleases: true + - name: "Show environment" + run: | + set -xe + python -VV + python -m site + # For extreme debugging: + # python -c "import urllib.request as r; exec(r.urlopen('https://bit.ly/pydoctor').read())" + env + - name: "Install dependencies" + run: | + set -xe + python -m pip install -r requirements/dev.pip + - name: run coverage + run : | + coverage run --omit="*.txt" -m unittest discover -t. -s tests -p "test_*.py" --locals + coverage xml -q + - name: Upload to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + name: unittest-py3.9 + token: ${{ secrets.CODECOV_TOKEN }} + slug: msftcangoblowm/logging-strict + os: linux + flags: unittests + file: ./coverage.xml + env_vars: OS,PYTHON + fail_ci_if_error: true + verbose: true diff --git a/CHANGES.rst b/CHANGES.rst index 1752b2e..83b423c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -32,10 +32,16 @@ Changelog Commit items for NEXT VERSION .............................. - - chore: add codecov config file - .. scriv-start-here +.. _changes_1-2-29: + +Version 1.2.29 — 2024-04-08 +--------------------------- + +- chore: add codecov config file and workflow +- docs(README.rst): show codecov badge + .. _changes_1-2-28: Version 1.2.28 — 2024-04-08 diff --git a/README.rst b/README.rst index e648814..6b08100 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ logging-strict logging.config yaml Strict typing and editable | |kit| |license| |versions| -| |test-status| |quality-status| |docs| +| |test-status| |codecov| |quality-status| |docs| | |stars| |mastodon-msftcangoblowm| For logging.config yaml files, logging-strict does the following: @@ -54,7 +54,7 @@ For logging.config yaml files, logging-strict does the following: sphinx object inventories; eliminate sphinx warnings; package logo; tox.ini; many .github/workflows; Tagged version on testpypi, pypi, and readthedocs; -badges; VHS tapes; +badges; VHS tapes; codecov badge; **New in 1.1.x:** @@ -587,3 +587,6 @@ yaml security issues: .. |mastodon-msftcangoblowm| image:: https://img.shields.io/mastodon/follow/112019041247183249 :target: https://mastodon.social/@msftcangoblowme :alt: msftcangoblowme on Mastodon +.. |codecov| image:: https://codecov.io/gh/msftcangoblowm/logging-strict/graph/badge.svg?token=HCBC74IABR + :target: https://codecov.io/gh/msftcangoblowm/logging-strict + :alt: logging-strict coverage percentage diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..a30b482 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + target: 90% + threshold: 0.2% + patch: + default: + target: 75% + threshold: 0.2% diff --git a/docs/conf.py b/docs/conf.py index efdd57f..7b58ead 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,9 +61,9 @@ # @@@ editable copyright = "2023–2024, Dave Faulkmore" # The short X.Y.Z version. -version = "1.2.28" +version = "1.2.29" # The full version, including alpha/beta/rc tags. -release = "1.2.28" +release = "1.2.29" # The date of release, in "monthname day, year" format. release_date = "April 8, 2024" # @@@ end