Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage report to the GitHub Actions summary #20

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: "1" # Make tools pretty.
TOX_TESTENV_PASSENV: FORCE_COLOR
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
# Keep in sync with .pre-commit-config.yaml/default_language_version/python.
PYTHON_LATEST: "3.12"

jobs:
tests:
name: Python ${{ matrix.python-version }}
Expand All @@ -33,8 +41,8 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade 'tox>=4.0.0rc3'
python -Im pip install --upgrade pip setuptools wheel
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now there's another I'm not in the habbit of using.

python -Im pip install --upgrade 'tox>=4.7'

- name: Run tox targets for ${{ matrix.python-version }}
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
Expand All @@ -54,10 +62,10 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: ${{env.PYTHON_LATEST}}

- name: Install dependencies
run: python -m pip install --upgrade coverage[toml]
run: python -Im pip install --upgrade coverage[toml]

- name: Download data
uses: actions/download-artifact@v4
Expand All @@ -68,9 +76,11 @@ jobs:

- name: Combine coverage and fail if it's <100%
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report
python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
python -Im coverage report
echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY

- name: Upload HTML report
if: ${{ failure() }}
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ deps = -r requirements/{envname}.txt
package = wheel
set_env =
PYTHONDEVMODE = 1

pass_env =
FORCE_COLOR
NO_COLOR