Skip to content

Commit

Permalink
codecov integration
Browse files Browse the repository at this point in the history
- chore: add codecov config file and workflow
- docs(README.rst): show codecov badge
  • Loading branch information
msftcangoblowm committed Apr 8, 2024
1 parent 731a940 commit 8020a2d
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 6 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
10 changes: 8 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:**

Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
target: 90%
threshold: 0.2%
patch:
default:
target: 75%
threshold: 0.2%
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8020a2d

Please sign in to comment.