-
Notifications
You must be signed in to change notification settings - Fork 2
chore(ci): Combine code coverage in CI before uploading to codecov #24
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughPer-version tests-unit matrix jobs now emit and upload a raw Sequence Diagram(s)sequenceDiagram
participant Matrix as tests-unit (matrix)
participant Artifacts as Artifact Storage
participant Combine as coverage-combine
participant Coverage as coverage tool
participant Codecov as Codecov
Note over Matrix: Parallel per-version runs
Matrix->>Matrix: run tests -> produce .coverage
Matrix->>Matrix: check for root .coverage
Matrix->>Artifacts: upload coverage-${matrix.python-version} (.coverage)
Combine->>Artifacts: download all coverage-*.coverage artifacts
Combine->>Combine: rename/download to unique .coverage.*
alt multiple .coverage files
Combine->>Coverage: run `coverage combine` on .coverage.*
Note right of Coverage: merges into coverage/.coverage
else single .coverage file
Combine->>Combine: use single .coverage as-is
end
Combine->>Coverage: generate coverage.xml, coverage.json, htmlcov in coverage/
Combine->>Artifacts: upload coverage-data/coverage.xml (coverage-combined-report)
Combine->>Codecov: upload coverage-data/coverage.xml (flags: combined, slug: repo, disable_search: true)
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (4)
Comment |
|
📦 Python package built successfully!
|
|
🚀 Review App Deployment Started
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/ci.yml(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build and push artifacts for Python 3.13
- GitHub Check: Build and push artifacts for Python 3.11
- GitHub Check: Build and push artifacts for Python 3.9
- GitHub Check: Build and push artifacts for Python 3.12
- GitHub Check: Build and push artifacts for Python 3.10
🔇 Additional comments (7)
.github/workflows/ci.yml (7)
360-381: Coverage file handling logic is sound.The script correctly detects and processes both single
.coverageand parallel.coverage.*files, with proper error handling for the no-data case. Bash shopt and array checks are idiomatic.
383-389: LGTM. Path and conditional guard are consistent with the coverage file handling above.
398-404: LGTM. Artifact naming, retention, and conditional guard align with the coverage-combine job expectations.
433-456: Coverage combine logic is robust.The combine step safely handles missing artifacts (no files found → success=false, exit 0), runs
coverage combineto merge per-version files, and generates the XML report. The cascading success check prevents downstream failures if no data exists.
468-474: LGTM. Combined coverage artifact retained for 30 days, sensible for reference and audit.
425-431: Theslugparameter in codecov-action v5 is valid and documented as "[Required when using the org token] Set the owner/repo slug used instead of the private repo token. Only applicable to some Enterprise users." Using it explicitly is optional but harmless for standard repositories.When
merge-multiple: trueis used withpattern, all artifact contents are extracted into the same directory. This confirms that.coverage.3.9,.coverage.3.10, etc. files from eachcoverage-*artifact will be properly merged intocoverage-data/wherecoverage.combine()can locate them.The workflow structure is sound: the download step with
merge-multiple: trueandpattern: coverage-*will correctly collect all per-version.coverage.*files into a single directory for the combine step.
458-466: No action needed —slugis optional in codecov-action v5.The action requires only
token(for private repos without OIDC) and optionallyuse_oidc. Theslugparameter is not required; including it is optional but harmless. The code is correct as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/ci.yml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Build and push artifacts for Python 3.9
- GitHub Check: Build and push artifacts for Python 3.13
- GitHub Check: Build and push artifacts for Python 3.10
- GitHub Check: Build and push artifacts for Python 3.12
- GitHub Check: Build and push artifacts for Python 3.11
- GitHub Check: Test - Python 3.9
- GitHub Check: Test - Python 3.10
- GitHub Check: Test - Python 3.11
🔇 Additional comments (5)
.github/workflows/ci.yml (5)
353-361: Verify coverage data file checks and outputs are sound.The logic checks for
.coverageexistence and setscoverage_generatedoutput; subsequent steps conditionally run based on this. The flow is correct.Please confirm that when all test jobs fail (no
.coverageartifacts generated), the desired behavior is to skip the Codecov upload gracefully without failing the workflow, as the current code at line 426–430 does withexit 0.
366-367: Per-version coverage report generation without explicit data-file reference.The
coverage report --format=markdowncommand relies on default.coveragefile discovery. Given the prior check at line 354 confirms the file exists, this should work correctly. Clean simplification from the prior approach.
384-390: Coverage artifact uploads are well-structured.Per-version
.coveragefiles are uploaded with unique names (coverage-${{ matrix.python-version }}) and short retention (1 day). The artifact pattern and path structure align with the subsequent download logic in the coverage-combine job. Clean approach.
392-450: Coverage combine job design is sound; artifact aggregation logic verified.The job correctly:
- Depends on
tests-unitwithif: always()to run even on partial failures- Downloads all matching artifacts into subdirectories (line 414–415)
- Searches for
.coveragefiles in the correct nested structure (line 424:coverage-artifacts/*/.coverage)- Renames files to
.coverage.*format forcoverage combine(lines 437–440)- Runs combine, generates XML, and reports markdown summary
- Sets
successoutput to control downstream Codecov uploadThe shell script uses
shopt -s nullglobto gracefully handle zero matches and exits cleanly if no files are found. This prevents false failures when tests don't produce coverage (e.g., all jobs failed).
451-467: Codecov upload configuration and artifact handling are correct.
slug: ${{ github.repository }}is explicit and clear (line 456)files: ./coverage-data/coverage.xmlcorrectly references the combined report from repo root (line 457)flags: combineddistinguishes this from per-version reports (line 458)- Conditional
if: steps.combine.outputs.success == 'true'prevents uploads when no coverage data exists (line 452)- Combined report artifact is retained for 30 days, appropriate for reference (line 467)
The upload parameters align with the codecov-action v5 API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/ci.yml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build and push artifacts for Python 3.13
- GitHub Check: Build and push artifacts for Python 3.9
- GitHub Check: Build and push artifacts for Python 3.11
- GitHub Check: Build and push artifacts for Python 3.12
- GitHub Check: Build and push artifacts for Python 3.10
🔇 Additional comments (3)
.github/workflows/ci.yml (3)
376-383: Artifact upload for per-version coverage looks correct.Using
include-hidden-files: trueensures.coverage(dot file) is captured. The 1-day retention for intermediate per-version artifacts is appropriate; they're temporary staging for the combine job.
353-361: Coverage check with explicit error handling is solid.Exiting with code 1 when
.coverageis missing ensures test environments that fail to generate coverage data are caught. Given pytest is invoked with--covflags, this should only trigger on actual errors, making the error signal clear.
444-452: Codecov integration uses appropriate parameters.Explicit
slug: ${{ github.repository }},flags: combined, and conditionalfail_ci_if_error(base repo / push only) are well-configured. The combined coverage upload replaces per-version uploads, centralizing the report.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
- Coverage 75.39% 72.87% -2.52%
==========================================
Files 99 93 -6
Lines 5625 5140 -485
Branches 784 753 -31
==========================================
- Hits 4241 3746 -495
+ Misses 1384 1150 -234
- Partials 0 244 +244
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/ci.yml (1)
395-411: Missing error handling when no coverage artifacts exist.If all
tests-unitjobs fail and upload no artifacts, the download step finds nothing, the loop at lines 401-404 executes zero times (due tonullglob), andcoverage combine coverage-data/runs on an empty directory at line 406. This will causecoverage xml(line 407) to fail or produce invalid output, breaking the Codecov upload.Add a check after the loop to handle this case gracefully:
for file in coverage-artifacts/*/.coverage; do cp "$file" "coverage-data/.coverage.$i" i=$((i + 1)) done + if [ $i -eq 0 ]; then + echo "⚠️ No coverage files found; tests may have failed" | tee -a $GITHUB_STEP_SUMMARY + echo "Skipping coverage upload" + exit 0 + fi + coverage combine coverage-data/Note: Past review comments indicate similar error handling was previously addressed, but it's not present in the current code. Verify whether it was removed or the line numbers shifted.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/ci.yml(1 hunks)noxfile.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build and push artifacts for Python 3.13
- GitHub Check: Build and push artifacts for Python 3.9
- GitHub Check: Build and push artifacts for Python 3.10
- GitHub Check: Build and push artifacts for Python 3.11
- GitHub Check: Build and push artifacts for Python 3.12
🔇 Additional comments (3)
.github/workflows/ci.yml (3)
349-352: LGTM: Per-version summary improves workflow visibility.Markdown format provides clear per-version coverage metrics in the workflow summary.
361-368: LGTM: Artifact upload correctly configured.The step properly uploads the
.coveragefile with appropriate settings: short retention (1 day), includes hidden files, and errors if missing. This ensures coverage data flows to the combine job.
413-428: LGTM: Codecov upload properly configured.The upload correctly specifies the repository slug, points to the combined XML file, sets the
combinedflag, and disables file search. The artifact upload preserves the report for 30 days. Both steps depend on successful coverage combination (implicit via the combine step not exiting early).
Summary by CodeRabbit