Skip to content

Commit 039a3aa

Browse files
chore: split codecov to collect and upload workflows (aws#34451)
### Issue # (if applicable) same as aws#34247 aws#34211 Closes #<issue number here>. ### Reason for this change ### Description of changes ### Describe any new or updated permissions being added Codecov is split into `collect` with lesser permissions and `upload` with escalated permissions. ### Description of how you validated changes ### Checklist - [ x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6460ffe commit 039a3aa

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Codecov Collect
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
collect:
11+
name: Collect Coverage
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node
19+
uses: actions/setup-node@v4
20+
21+
- name: Install dependencies
22+
run: yarn install
23+
24+
- name: Build Library
25+
run: npx lerna run build --scope=aws-cdk-lib
26+
27+
- name: Run Core tests
28+
run: cd packages/aws-cdk-lib && yarn test core
29+
30+
- name: Upload Coverage and PR Info
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: coverage-artifacts
34+
path: |
35+
packages/aws-cdk-lib/coverage/cobertura-coverage.xml
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Codecov Upload
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Codecov Collect"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: write
11+
id-token: write
12+
13+
jobs:
14+
upload:
15+
name: Upload to Codecov
16+
runs-on: ubuntu-latest
17+
if: >
18+
github.event.workflow_run.event == 'pull_request' &&
19+
github.event.workflow_run.conclusion == 'success'
20+
21+
steps:
22+
- name: Download Artifacts
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: coverage-artifacts
26+
path: ./coverage
27+
28+
- name: Upload to Codecov
29+
uses: codecov/codecov-action@v5
30+
with:
31+
files: ./coverage/packages/aws-cdk-lib/coverage/cobertura-coverage.xml
32+
fail_ci_if_error: true
33+
flags: suite.unit
34+
use_oidc: true

0 commit comments

Comments
 (0)