Skip to content

Commit b08966b

Browse files
committed
Fix premature Codecov status report
The Checks pipeline has 2 separate jobs that upload codecov results - Test and Acceptance. Test job always finishes first, so Codecov calculates status before Acceptance finishes, showing a red status (i.e. reduced coverage) that later turns green. To fix that, upload all coverage together after both Test and Acceptance jobs complete. Ref: https://issues.redhat.com/browse/EC-1591 Assisted-by: Claude
1 parent 9f4e9bf commit b08966b

File tree

1 file changed

+67
-27
lines changed

1 file changed

+67
-27
lines changed

.github/workflows/checks-codecov.yaml

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,32 +85,15 @@ jobs:
8585
- name: Test
8686
run: make test
8787

88-
- name: Upload unit test coverage report
89-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
90-
env:
91-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
92-
with:
93-
files: ./coverage-unit.out
94-
disable_search: true
95-
flags: unit
96-
97-
- name: Upload generative test coverage report
98-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
99-
env:
100-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
101-
with:
102-
files: ./coverage-generative.out
103-
disable_search: true
104-
flags: generative
105-
106-
- name: Upload integration test coverage report
107-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
108-
env:
109-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
88+
- name: Upload test coverage artifacts
89+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.0
11090
with:
111-
files: ./coverage-integration.out
112-
disable_search: true
113-
flags: integration
91+
name: coverage-test
92+
path: |
93+
./coverage-unit.out
94+
./coverage-generative.out
95+
./coverage-integration.out
96+
retention-days: 1
11497

11598
Acceptance:
11699
runs-on: ubuntu-latest
@@ -149,12 +132,69 @@ jobs:
149132
id: acceptance_test
150133
run: E2E_INSTRUMENTATION=true make acceptance
151134

152-
- name: Upload coverage report
135+
- name: Upload acceptance coverage artifact
136+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.0
137+
with:
138+
name: coverage-acceptance
139+
path: ./coverage-acceptance.out
140+
retention-days: 1
141+
142+
Upload:
143+
name: "Upload Coverage Statistics"
144+
runs-on: ubuntu-latest
145+
needs: [Test, Acceptance]
146+
steps:
147+
- name: Harden Runner
148+
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
149+
with:
150+
egress-policy: audit
151+
disable-telemetry: true
152+
153+
- name: Download test coverage artifacts
154+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
155+
with:
156+
name: coverage-test
157+
path: ./coverage
158+
159+
- name: Download acceptance coverage artifact
160+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
161+
with:
162+
name: coverage-acceptance
163+
path: ./coverage
164+
165+
- name: Upload unit test coverage report
166+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
167+
env:
168+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
169+
with:
170+
files: ./coverage/coverage-unit.out
171+
disable_search: true
172+
flags: unit
173+
174+
- name: Upload generative test coverage report
175+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
176+
env:
177+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
178+
with:
179+
files: ./coverage/coverage-generative.out
180+
disable_search: true
181+
flags: generative
182+
183+
- name: Upload integration test coverage report
184+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
185+
env:
186+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
187+
with:
188+
files: ./coverage/coverage-integration.out
189+
disable_search: true
190+
flags: integration
191+
192+
- name: Upload acceptance test coverage report
153193
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
154194
env:
155195
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
156196
with:
157-
files: ./coverage-acceptance.out
197+
files: ./coverage/coverage-acceptance.out
158198
disable_search: true
159199
flags: acceptance
160200

0 commit comments

Comments
 (0)