Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/badges/coverage.svg

This file was deleted.

29 changes: 6 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
if: github.event_name == 'push'
timeout-minutes: 10
permissions:
contents: write
contents: read

steps:
- name: Checkout code
Expand All @@ -59,29 +59,12 @@ jobs:
- name: Run tests with coverage
run: npm run test:coverage

- name: Read coverage summary
id: coverage
run: |
echo "pct=$(jq '.total.lines.pct' coverage/coverage-summary.json)" >> $GITHUB_OUTPUT

- name: Create badges directory
run: mkdir -p .github/badges

- name: Generate coverage badge
uses: emibcn/badge-action@f9150fde070fcca0c4e832437611b44838fcd325 # v2.0.4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
label: 'coverage'
status: ${{ steps.coverage.outputs.pct }}%
color: ${{ fromJSON(steps.coverage.outputs.pct) >= 80 && 'green' || fromJSON(steps.coverage.outputs.pct) >= 60 && 'yellow' || 'red' }}
path: .github/badges/coverage.svg

- name: Commit coverage badge
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .github/badges/coverage.svg
git diff --staged --quiet || git commit -m "Update coverage badge"
git push
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
fail_ci_if_error: true

- name: Upload coverage reports
uses: actions/upload-artifact@v7.0.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div align="center">

[![CI](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml/badge.svg)](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
[![Coverage](https://raw.githubusercontent.com/knowledgecode/date-and-time/refs/heads/master/.github/badges/coverage.svg)](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
[![Coverage](https://codecov.io/gh/knowledgecode/date-and-time/graph/badge.svg)](https://codecov.io/gh/knowledgecode/date-and-time)
[![npm](https://img.shields.io/npm/v/date-and-time)](https://www.npmjs.com/package/date-and-time)

</div>
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
exclude: ['src/**/*.d.ts'],
include: ['src/**/*.ts'],
provider: 'v8',
reporter: ['json-summary', 'html'],
reporter: ['html', 'lcov'],
thresholds: {
lines: 100,
statements: 100,
Expand Down
Loading