Conversation
Committed-by: nengli.ln from Dev container
| @@ -412,8 +410,7 @@ jobs: | |||
| make coverage | |||
|
|
|||
| - name: Upload coverage to Codecov | |||
| if: steps.scope.outputs.extension_only != 'true' && (github.ref == 'refs/heads/main' && github.repository == 'alibaba/neug' && github.event_name == 'push') | |||
| uses: codecov/codecov-action@v5 | |||
| with: | |||
| token: ${{ secrets.CODECOV_TOKEN }} | |||
| file: ${{ github.workspace }}/tools/python_bind/build/neug_py_bind/coverage_filtered.info | |||
| files: ${{ github.workspace }}/tools/python_bind/build/neug_py_bind/coverage_filtered.info | |||
There was a problem hiding this comment.
Coverage generation and upload now runs on all triggers, including PRs and forks
Both the "Generate Coverage Report" step (line 404) and the "Upload coverage to Codecov" step (line 412) have had their if guards removed. This creates several problems:
-
Extension-only builds: When
extension_only == 'true', the preceding build steps that produce coverage data are skipped (they still carryif: steps.scope.outputs.extension_only != 'true'). As a result,make coveragewill have no.gcda/.gcnodata to process and will either fail or produce a meaningless empty report. -
Fork PRs / untrusted PRs:
${{ secrets.CODECOV_TOKEN }}is not available in workflows triggered from forks. The upload step will fail with an authentication error on every external contributor's PR. -
All pull requests: Even for internal PRs, uploading partial/PR-run coverage to Codecov on every PR push pollutes the repository's coverage history and may override the canonical main-branch coverage data.
Consider restoring the if condition on both steps, or at minimum restoring the extension_only and fork/PR guards:
| - name: Generate Coverage Report | |
| if: steps.scope.outputs.extension_only != 'true' && github.ref == 'refs/heads/main' && github.repository == 'alibaba/neug' && github.event_name == 'push' | |
| run: | | |
| python3 -m pip install fastcov | |
| sudo apt update | |
| sudo apt install lcov -y | |
| cd ${GITHUB_WORKSPACE}/tools/python_bind/build/neug_py_bind | |
| make coverage |
| - name: Upload coverage to Codecov | |
| if: steps.scope.outputs.extension_only != 'true' && github.ref == 'refs/heads/main' && github.repository == 'alibaba/neug' && github.event_name == 'push' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ${{ github.workspace }}/tools/python_bind/build/neug_py_bind/coverage_filtered.info |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Committed-by: nengli.ln from Dev container
Committed-by: nengli.ln from Dev container
Fixes
Greptile Summary
This PR removes the branch/event/scope guards (
if:conditions) from three coverage-related steps — "Set ENABLE_GCOV for main branch", "Generate Coverage Report", and "Upload coverage to Codecov" — and renames thefile:parameter tofiles:in the Codecov upload action (a valid fix forcodecov-action@v5).files:rename is correct and necessary forcodecov/codecov-action@v5.ifconditions causesENABLE_GCOV=ONto be injected into every build (PRs, forks,workflow_dispatch), adding GCOV instrumentation overhead to all CI runs regardless of branch.make coverage) will now be attempted even for extension-only builds where no.gcda/.gcnodata was produced, which is likely to fail.CODECOV_TOKENis unavailable in fork workflows, breaking CI for external contributors.Confidence Score: 2/5
files:rename is a correct fix, but the removal of all threeifguards introduces build failures for extension-only runs (no coverage data exists) and authentication failures for fork PRs (noCODECOV_TOKEN). It also adds GCOV overhead to every PR build. These are concrete, reproducible breakages..github/workflows/neug-test.yml— specifically the three steps that lost theirif:conditions.Important Files Changed
ifconditions guarding GCOV setup, coverage generation, and Codecov upload were removed, causing those steps to run unconditionally on all triggers (PRs, forks, extension-only builds); thefile→filesparameter rename forcodecov-action@v5is correct.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Workflow Triggered] --> B{Event Type} B -->|push to main| C[Detect Scope] B -->|pull_request| C B -->|workflow_dispatch| C C --> D{extension_only?} D -->|true| E[Skip most build & test steps] D -->|false| F[Full Build & Test] E -->|BEFORE this PR| G_OLD["❌ Skip ENABLE_GCOV\n❌ Skip Coverage Generation\n❌ Skip Codecov Upload"] E -->|AFTER this PR| G_NEW["⚠️ Set ENABLE_GCOV=ON\n⚠️ Run make coverage\n⚠️ Attempt Codecov Upload\n(likely fails — no coverage data)"] F -->|BEFORE this PR| H{Is main branch push\nfrom alibaba/neug?} H -->|No PR/fork| I_OLD["❌ Skip ENABLE_GCOV\n❌ Skip Coverage Generation\n❌ Skip Codecov Upload"] H -->|Yes| J_OLD["✅ Set ENABLE_GCOV=ON\n✅ Generate Coverage\n✅ Upload to Codecov"] F -->|AFTER this PR| K["⚠️ Always Set ENABLE_GCOV=ON\n⚠️ Always Generate Coverage\n⚠️ Always Upload to Codecov\n(fork PRs fail — no CODECOV_TOKEN)"]Comments Outside Diff (1)
.github/workflows/neug-test.yml, line 135-141 (link)ENABLE_GCOVnow unconditionally set for all buildsThe
ifguard was removed, which meansENABLE_GCOV=ONis now injected into every run — including pull requests,workflow_dispatch, extension-only builds, and fork PRs. The original condition was:Enabling GCOV instrumentation adds significant compile-time and run-time overhead. All PR builds will now compile with coverage instrumentation even though that data is never meaningful during review. This will slow down every PR's build unnecessarily.
Last reviewed commit: c99e578