Skip to content

Commit

Permalink
ci: generate code coverage badge
Browse files Browse the repository at this point in the history
  • Loading branch information
kpietraszko committed Dec 29, 2024
1 parent a142b37 commit 8b20165
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 190 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
main:
name: Build and run tests
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
Expand All @@ -27,4 +29,16 @@ jobs:
version: 8
run_install: true
- run: pnpm build
- run: pnpm test
- run: pnpm test:coverage

- name: Publish Results Badge
uses: wjervis7/[email protected]
if: success() || failure() # run whether steps succeed or not
with:
result-type: statements
upload-badge: false

- name: Commit badge
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: './badge.svg'
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"release": "pnpm test && pnpm build && changelogen --release --push && pnpm publish",
"test": "vitest --run --typecheck",
"test:watch": "vitest",
"test:coverage": "vitest --run --typecheck --coverage",
"prepare": "husky"
},
"dependencies": {
Expand All @@ -44,6 +45,7 @@
"typescript": "~5.7.2",
"vite": "^6.0.3",
"vite-plugin-dts": "^4.3.0",
"vitest": "2.1.8"
"vitest": "2.1.8",
"@vitest/coverage-v8": "2.1.8"
}
}
Loading

0 comments on commit 8b20165

Please sign in to comment.