Skip to content

Commit 13e231d

Browse files
committed
ci: separate codecov workflow
1 parent 30bb360 commit 13e231d

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

.github/workflows/codecov.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Codecov for pull requests
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Continuous Deployment
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
coverage:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
ref: ${{ github.event.workflow_run.head_sha }}
22+
# Make sure that history is available to Codecov
23+
fetch-depth: 0
24+
25+
- name: Install pnpm package manager
26+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
27+
28+
- name: Setup Node.js version and cache
29+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
30+
with:
31+
node-version-file: .nvmrc
32+
33+
- name: Check for known security issues with npm packages
34+
run: |
35+
echo "Auditing npm dependencies before installing them. For more information, see: https://nldesignsystem.nl/pnpm-audit"
36+
pnpm audit --audit-level critical
37+
38+
- name: Install dependencies
39+
run: pnpm install --frozen-lockfile
40+
41+
- name: Download coverage-report artifact
42+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
43+
with:
44+
name: coverage-report
45+
# Needed to download an artifact created in a different workflow
46+
github-token: ${{ github.token }}
47+
run-id: ${{ github.event.workflow_run.id }}
48+
49+
- name: Upload coverage to codecov.io
50+
id: codecov-action
51+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
52+
with:
53+
fail_ci_if_error: true
54+
override_commit: ${{ github.event.workflow_run.head_sha }}
55+
override_pr: ${{ github.event.workflow_run.pull_requests[0].number }}
56+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Continuous Deployment
2+
# Triggers the following workflows:
3+
# - .github/workflows/codecov.yml
24

35
on:
46
push:
@@ -49,10 +51,12 @@ jobs:
4951
- name: Run the test script in package.json scripts
5052
run: pnpm run --if-present test
5153

52-
- name: Upload coverage reports to Codecov
53-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
54+
- name: Upload coverage-report artifact
55+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
5456
with:
55-
token: ${{ secrets.CODECOV_TOKEN }}
57+
name: coverage-report
58+
path: "**/coverage/"
59+
retention-days: 1
5660

5761
- name: Publish to Chromatic
5862
uses: chromaui/action@4c20b95e9d3209ecfdf9cd6aace6bbde71ba1694 # v13.3.4

0 commit comments

Comments
 (0)