Skip to content

Commit 3a69d01

Browse files
committed
ci: update workflows
1 parent f1ea26b commit 3a69d01

6 files changed

Lines changed: 59 additions & 32 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,54 @@
11
name: coverage report
22

33
on:
4-
pull_request:
4+
workflow_run:
5+
workflows:
6+
- quality checks
57
types:
6-
- opened
7-
- synchronize
8-
- reopened
8+
- completed
99

1010
permissions:
1111
contents: read
1212
pull-requests: write
13+
actions: read
1314

1415
jobs:
1516
coverage:
1617
runs-on: ubuntu-latest
17-
if: github.event_name == 'pull_request' && !startsWith(github.head_ref, 'release-please')
18+
if: ${{ github.event.workflow_run.event == 'pull_request' && !startsWith(github.event.workflow_run.head_branch, 'release-please') }}
1819
steps:
19-
- name: Check out repository code
20-
uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121

22-
- uses: oven-sh/setup-bun@v2
22+
- name: Download coverage artifact
23+
uses: actions/download-artifact@v5
2324
with:
24-
bun-version: latest
25-
26-
- name: install
27-
run: bun install
25+
name: coverage
26+
path: coverage
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
run-id: ${{ github.event.workflow_run.id }}
2829

29-
- name: Run tests (lcov reporter)
30-
shell: bash
31-
run: bun test:lcov
30+
- name: Setup Bun
31+
uses: oven-sh/setup-bun@v2
32+
with:
33+
bun-version: latest
3234

33-
- name: Build PR comment body from lcov-summary
35+
- name: coverage output
36+
id: coverage
3437
shell: bash
3538
run: |
36-
if [ ! -s "${GITHUB_WORKSPACE}/coverage/lcov.info" ]; then
37-
printf '%s\n' 'Coverage report not found' > "${RUNNER_TEMP}/comment.md"
38-
exit 0
39-
fi
40-
41-
# Output directly as the comment body
42-
npx -y lcov-summary "${GITHUB_WORKSPACE}/coverage/lcov.info" > "${RUNNER_TEMP}/comment.md"
39+
{
40+
echo "body<<EOF"
41+
bunx lcov-summary "${GITHUB_WORKSPACE}/coverage/lcov.info"
42+
echo "EOF"
43+
} >> "$GITHUB_OUTPUT"
4344
44-
- name: Post or update sticky PR comment
45+
- name: coverage report
4546
uses: marocchino/sticky-pull-request-comment@v2
4647
with:
4748
header: Coverage Report
48-
path: ${{ runner.temp }}/comment.md
49+
message: |
50+
### Coverage Report
51+
52+
```
53+
${{ steps.coverage.outputs.body }}
54+
```

.github/workflows/docs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1615

1716
- name: Upload pages artifact
1817
uses: actions/upload-pages-artifact@v3
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ on:
1313
- tsconfig.json
1414
- .github/workflows/**.yml
1515

16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
actions: write
20+
1621
jobs:
1722
test:
1823
runs-on: ubuntu-latest
1924
steps:
20-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
2126
- uses: oven-sh/setup-bun@v2
2227
with:
2328
bun-version: latest
@@ -28,13 +33,31 @@ jobs:
2833
- name: typecheck
2934
run: bun run typecheck
3035

36+
- name: bunfig.toml
37+
shell: bash
38+
run: |
39+
cat > "${GITHUB_WORKSPACE}/bunfig.toml" <<'EOF'
40+
[test]
41+
coveragePathIgnorePatterns = [
42+
"src/testdata/**",
43+
]
44+
EOF
45+
3146
- name: test
3247
run: bun test
3348

49+
- name: upload coverage artifact
50+
if: github.event_name == 'pull_request'
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: coverage
54+
path: coverage/lcov.info
55+
if-no-files-found: warn
56+
3457
fmt:
3558
runs-on: ubuntu-latest
3659
steps:
37-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v5
3861
- uses: oven-sh/setup-bun@v2
3962
with:
4063
bun-version: latest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
config-file: ${{ github.event.inputs.release_next == 'true' && '.github/.release-config.next.json' || '.github/.release-config.json' }}
3333
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
3434

35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v5
3636
if: ${{ steps.release.outputs.release_created || github.event.inputs.tag }}
3737
with:
3838
ref: ${{ github.event.inputs.tag || 'master' }}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
"fmt": "dprint fmt",
2323
"fmt:check": "dprint check",
2424
"typecheck": "tsc --noEmit",
25-
"test": "bun test --coverage .",
26-
"test:lcov": "bun test --coverage --coverage-reporter lcov .",
25+
"test": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov",
2726
"test:watch": "bun test --watch --coverage ."
2827
},
2928
"dependencies": {

0 commit comments

Comments
 (0)