Skip to content

Commit 30190c1

Browse files
ptomanRHclaude
andauthored
ci: onboard Codecov for unit test coverage tracking (#510)
## Summary - Add `codecov/codecov-action@v5` to the PR workflow with OIDC authentication (`use_oidc: true`) to upload JaCoCo coverage reports to [app.codecov.io](https://app.codecov.io) - Replace the `actions/upload-artifact` step with the Codecov upload step, keeping the same matrix guard (`matrix.java == env.MAIN_JAVA_VER`) - Add `id-token: write` permission at job level for OIDC token exchange - Add `codecov.yml` with informational status checks, `unit-tests` flag with carryforward enabled, and ignore patterns for test/resource/build directories ## Details The existing JaCoCo setup is already complete: - Version 0.8.14 declared in `pluginManagement` - `prepare-agent` and `check` goals in the main build plugins - `report` goal in the `cov` profile (activated by `-Pcov`) - Excludes configured for API model, exception, impl, and logging packages No changes to `pom.xml` were needed. ## Test plan - [ ] Verify the PR workflow runs successfully and the Codecov step uploads coverage - [ ] Check that the Codecov status checks appear on the PR (informational, non-blocking) - [ ] Confirm coverage report is visible at https://app.codecov.io/gh/guacsec/trustify-da-java-client Ref: COVERPORT-253 ## Summary by Sourcery Integrate Codecov into the PR workflow to upload JaCoCo coverage for the main Java version and configure repository-wide coverage reporting behavior. New Features: - Introduce Codecov integration for tracking unit test coverage in the repository. Enhancements: - Add a Codecov configuration file to define informational project and patch status checks, a unit-test coverage flag with carryforward, and directory ignore rules for coverage calculations. CI: - Update the PR GitHub Actions workflow to upload JaCoCo coverage to Codecov using OIDC authentication for the main Java matrix entry. - Grant id-token write permission in the PR workflow job to enable OIDC-based authentication for Codecov uploads. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3b9c5e2 commit 30190c1

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

.github/workflows/pr.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
permissions:
1414
checks: write
1515
pull-requests: write
16+
id-token: write
1617
env:
1718
MAIN_JAVA_VER: 21
1819
RUN_PYTHON_BIN: ${{ vars.RUN_PYTHON_BIN }}
@@ -66,9 +67,10 @@ jobs:
6667
./target/surefire-reports/*.xml
6768
./target/junit-platform/TEST-junit-jupiter.xml
6869
69-
- name: Upload coverage reports
70+
- name: Upload coverage to Codecov
7071
if: ${{ matrix.java == env.MAIN_JAVA_VER }}
71-
uses: actions/upload-artifact@v7
72+
uses: codecov/codecov-action@v5
7273
with:
73-
name: coverage-${{ matrix.java }}
74-
path: ./target/site/jacoco/jacoco.xml
74+
use_oidc: true
75+
flags: integration-tests
76+
files: ./target/site/jacoco/jacoco.xml

codecov.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
codecov:
2+
require_ci_to_pass: false
3+
4+
comment:
5+
layout: "reach,diff,flags,components"
6+
behavior: default
7+
require_changes: false
8+
require_base: false
9+
require_head: true
10+
hide_project_coverage: false
11+
12+
coverage:
13+
status:
14+
project:
15+
default:
16+
informational: true
17+
patch:
18+
default:
19+
informational: true
20+
21+
flags:
22+
integration-tests:
23+
paths:
24+
- src/main/java/
25+
carryforward: true
26+
27+
ignore:
28+
- "src/test/"
29+
- "src/main/resources/"
30+
- "target/"
31+
- "docs/"

0 commit comments

Comments
 (0)