|
42 | 42 | types: [ completed ] |
43 | 43 |
|
44 | 44 | concurrency: |
45 | | - group: ${{ github.workflow }}-${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} |
| 45 | + # Include `github.event_name` so a workflow_run-triggered run never |
| 46 | + # falls into the same group as a workflow_dispatch run on the same |
| 47 | + # branch. Without this, dispatching on a feature branch while a |
| 48 | + # workflow_run for v3.0 is also active cancels the dispatch even |
| 49 | + # though the branches differ -- GitHub's concurrency comparison |
| 50 | + # appears to ignore the head_branch suffix in practice. Two |
| 51 | + # workflow_runs for the same branch still serialize via this group; |
| 52 | + # so do two dispatches for the same branch. |
| 53 | + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} |
46 | 54 | cancel-in-progress: true |
47 | 55 |
|
48 | 56 | env: |
|
61 | 69 | if: ${{ github.event.workflow_run && github.event.workflow_run.conclusion == 'success' || ! github.event.workflow_run }} |
62 | 70 | runs-on: ubuntu-24.04 |
63 | 71 | timeout-minutes: 120 |
| 72 | + # codecov/codecov-action@v4 needs `id-token: write` to mint a |
| 73 | + # GitHub OIDC token for tokenless uploads against the Codecov |
| 74 | + # GitHub App. Without this, the upload falls back to legacy |
| 75 | + # token-based auth and fails on protected target branches with |
| 76 | + # `HTTP 400: Token required because branch is protected` even |
| 77 | + # though the app is installed. We keep `contents: read` (the |
| 78 | + # GitHub default) explicit so granting id-token: write here |
| 79 | + # doesn't implicitly widen any other scope. |
| 80 | + permissions: |
| 81 | + contents: read |
| 82 | + id-token: write |
64 | 83 |
|
65 | 84 | steps: |
66 | 85 |
|
@@ -141,6 +160,37 @@ jobs: |
141 | 160 | path: coverage/lcov.info |
142 | 161 | if-no-files-found: warn |
143 | 162 |
|
| 163 | + - name: Upload coverage to Codecov |
| 164 | + # Send the same lcov.info we already archive as a workflow artifact |
| 165 | + # to Codecov so PRs get the "this PR changes coverage of touched |
| 166 | + # files from N% to M%" comment and main accumulates a historical |
| 167 | + # graph at https://app.codecov.io/gh/sysown/proxysql. |
| 168 | + # |
| 169 | + # `if: always()` so coverage uploads regardless of whether the unit |
| 170 | + # tests themselves passed; partial coverage is still useful for |
| 171 | + # diagnosing why a PR went red. `fail_ci_if_error: false` so a |
| 172 | + # transient Codecov outage never gates a green CI run on a |
| 173 | + # third-party SaaS. |
| 174 | + if: always() |
| 175 | + uses: codecov/codecov-action@v4 |
| 176 | + with: |
| 177 | + files: coverage/lcov.info |
| 178 | + flags: unit-tests |
| 179 | + name: unit-tests-asan-coverage |
| 180 | + # Tokenless upload via GitHub OIDC. Codecov treats every branch |
| 181 | + # as "protected" by default and rejects unauthenticated uploads |
| 182 | + # with HTTP 400 "Token required because branch is protected" -- |
| 183 | + # this is Codecov's own branch-protection concept, unrelated to |
| 184 | + # GitHub's. The fix is `use_oidc: true`, which makes the action |
| 185 | + # mint a GitHub OIDC token (granted by `permissions: |
| 186 | + # id-token: write` on this job) and present it to Codecov in |
| 187 | + # place of a static upload token. Without `use_oidc: true` the |
| 188 | + # action silently falls back to legacy tokenless mode and the |
| 189 | + # upload fails. |
| 190 | + use_oidc: true |
| 191 | + fail_ci_if_error: false |
| 192 | + verbose: true |
| 193 | + |
144 | 194 | - name: Upload coverage HTML report |
145 | 195 | if: always() |
146 | 196 | uses: actions/upload-artifact@v4 |
|
0 commit comments