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

Try to make Codecov less of a blocker #1156

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
63 changes: 61 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,25 @@ jobs:
name: trial
path: .tox/${TOX_ENV}/log/trial.log

# The Codecov service causes too many CI failures.
# We'll verify coverage ourselves but attempt to upload to Codecov so that
# (when uploads work) we can use its features without relying on it to pass CI.

- name: DEBUG
if: ${{ matrix.tox-prefix == 'coverage' }}
run: find . -name '*coverage*' -print

- name: Upload coverage data
uses: actions/upload-artifact@v4
if: ${{ matrix.tox-prefix == 'coverage' }}
with:
name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }}
path: .tox/coverage.*

# Use the latest supported Python version for combining coverage to
# prevent parsing errors in older versions when looking at modern code.
- uses: "actions/setup-python@v5"
- name: Install latest Python
uses: "actions/setup-python@v5"
if: ${{ matrix.tox-prefix == 'coverage' }}
with:
python-version: "3.12"
Expand All @@ -321,14 +337,57 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: .tox/coverage.xml
env_vars: GITHUB_REF,GITHUB_COMMIT,GITHUB_USER,GITHUB_WORKFLOW
fail_ci_if_error: true
fail_ci_if_error: false
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_USER: ${{ github.actor }}
GITHUB_WORKFLOW: ${{ github.workflow }}


coverage:
name: Check code coverage

needs: unit
if: ${{ always() }}

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
# Use the latest supported Python version for combining coverage to
# prevent parsing errors in older versions when looking at modern code.
- name: Install Python
uses: "actions/setup-python@v5"
if: ${{ matrix.tox-prefix == 'coverage' }}
with:
python-version: "3.12"

- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true

- name: Check coverage
run: |
export COVERAGE_FILE="./.tox/coverage"
find . -name '*coverage*' -print
pip install coverage
coverage combine
if ! coverage report --fail-under=100; then
coverage html --skip-covered --skip-empty
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
exit 1
fi

- name: Upload coverage report if check failed
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: coverage-report
path: htmlcov


docker-build:
name: Build Docker image

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commands =
# - Use `tox -e coverage_report` to generate a report for all environments.
coverage: python -c 'f=open("{envsitepackagesdir}/zz_coverage.pth", "w"); f.write("import coverage; coverage.process_startup()\n")'
coverage: coverage erase
coverage: coverage run --parallel-mode --source="{env:PY_MODULE}" "{envdir}/bin/trial" --random=0 {env:TRIAL_JOBS} --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}
coverage: coverage run --branch --parallel-mode --source="{env:PY_MODULE}" "{envdir}/bin/trial" --random=0 {env:TRIAL_JOBS} --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}
coverage: coverage combine
coverage: coverage xml -o {toxworkdir}/coverage.xml

Expand Down
Loading