Skip to content

Commit f44df6c

Browse files
authored
Merge pull request #1133 from neutrons/ci/codecov-oidc
Upload coverage to Codecov with OIDC (next has had none since 2024-09)
2 parents 49ab064 + 6b2739a commit f44df6c

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

‎.github/workflows/test_and_deploy.yaml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
test-tier:
2525
name: tests (${{ matrix.tier }})
2626
runs-on: ubuntu-latest
27+
# id-token lets the Codecov upload authenticate by OIDC instead of a CODECOV_TOKEN secret,
28+
# which Codecov requires for every non-fork branch (it rejected all next uploads without one)
29+
permissions:
30+
contents: read
31+
id-token: write
2732
strategy:
2833
fail-fast: false
2934
matrix:
@@ -72,14 +77,16 @@ jobs:
7277
ls -la coverage.xml || echo "No coverage.xml found"
7378
7479
- name: upload coverage to codecov
75-
uses: codecov/codecov-action@v7
80+
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
7681
if: github.actor != 'dependabot[bot]'
7782
with:
78-
token: ${{ secrets.CODECOV_TOKEN }}
83+
use_oidc: true
7984
files: ./coverage.xml
8085
flags: ${{ matrix.tier }}
8186
name: codecov-${{ matrix.tier }}
82-
fail_ci_if_error: false
87+
# A rejected upload on next/main must be visible (it went unnoticed for two years);
88+
# on PRs a Codecov outage should not block merging.
89+
fail_ci_if_error: ${{ github.event_name == 'push' }}
8390
verbose: true
8491

8592
tests:

‎codecov.yaml‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎codecov.yml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
# CI uploads coverage once per test tier (unit, ring-calibration, integration, gui; #1100, #1101):
2-
# report only once all four have arrived, so an early upload alone never shows as a coverage drop
1+
# Configuration file for codecov reporting code coverage
2+
33
codecov:
4+
# Codecov's default branch is master and its settings page won't save, so name it here
5+
branch: next
6+
# CI uploads coverage once per test tier (unit, ring-calibration, integration, gui):
7+
# report only once all four have arrived, so an early upload alone never shows as a
8+
# coverage drop
49
notify:
510
after_n_builds: 4
11+
12+
# One coverage comment per PR, posted once all four tiers have uploaded
613
comment:
714
after_n_builds: 4
15+
16+
# files to ignore
17+
ignore:
18+
- pyrs/_version.py
19+
- pyrs/icons/icons_*.py
20+
21+
# Fixes report prefix paths from CI dynamic coverage action
22+
# from https://docs.codecov.io/docs/fixing-paths
23+
fixes:
24+
- "*/pyrs/::/pyrs/"

0 commit comments

Comments
 (0)