Skip to content

ci(codecov): upload coverage with OIDC instead of a token - #113

Merged
maksimtech merged 1 commit into
mainfrom
ci/codecov-oidc
Nov 22, 2026
Merged

maksimtech merged 1 commit into
mainfrom
ci/codecov-oidc

Conversation

@maksimtech

Copy link
Copy Markdown
Owner

Same as maksimtech/mailradar#135 and maksimtech/cookieradar#104, both merged; on each, the upload log now names the repository's own project.

Why

The coverage upload authenticated with the CODECOV_TOKEN secret, and Codecov files an upload under the project its token belongs to. Every Tests run here since at least 2026-10-17 logged results will be available at: app.codecov.io/github/maksimtech/exeradar/commit/…: this repository's secret held exeradar's token. So this repository's Codecov project got no reports, and codecov/patch on #111 stayed "in progress" for good, waiting for one.

What

  • test.yml: the Codecov step uses use_oidc: true and no token; the test job gets permissions: contents: read, id-token: write (job permissions replace the workflow's).
  • tests/test_codecov_contract.py: test_the_upload_is_given_a_token is replaced, on purpose, by test_the_upload_proves_which_repository_it_comes_from. It requires use_oidc: true and id-token: write on every job that uploads, and forbids a token in the step and secrets.CODECOV_TOKEN anywhere.

Checks

  • The new test failed before the workflow change (the upload does not use OIDC).
  • pytest: 2431 passed, 4 skipped. ruff check src tests benchmarks scripts tools: clean.
  • The proof is this pull request's own Tests run: its upload log should name maksimtech/patchradar, and codecov/patch should report.

After merge, the CODECOV_TOKEN secret of this repository is unused and can be deleted (a repository setting).

Not to be auto-merged: merge by hand after review.

🤖 Generated with Claude Code

Codecov files an upload under the project its token belongs to. This
repository's CODECOV_TOKEN secret held exeradar's token, so every
coverage report since at least 2026-10-17 went to exeradar's project,
and codecov/patch on #111 waited for one that never came.

The upload now uses OIDC (use_oidc: true; id-token: write on the test
job, contents: read repeated since job permissions replace the
workflow's): GitHub tells Codecov which repository the job runs in.
test_the_upload_is_given_a_token becomes a test that requires OIDC and
forbids the secret. Same as maksimtech/mailradar#135.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maksimtech maksimtech added the enhancement New feature or request label Nov 22, 2026
@codspeed

codspeed Bot commented Nov 22, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 11 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 17 untouched benchmarks


Comparing ci/codecov-oidc (e72e0aa) with main (210be61)

Open in CodSpeed

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant