Skip to content

Commit

Permalink
feat(workflows/ci/reports): added coverage report badge (needed bun `…
Browse files Browse the repository at this point in the history
…v1.1.17`, closes #31)
  • Loading branch information
jonasfroeller committed Jun 26, 2024
1 parent 71e1542 commit 81ff869
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
bun-version: 1.1.6

- name: Install dependencies
run: bun install
run: |
bun install
bun install lcov-parse
# outputs coverage/lcov.info
- name: Run tests
env:
DEV_MODE: true
Expand All @@ -29,11 +32,15 @@ jobs:
GITHUB_APP_ID: ${{ secrets.GH_APP_ID }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
GITHUB_APP_WEBHOOK_SECRET: ${{ secrets.GH_APP_WEBHOOK_SECRET }}
run: bun test --coverage

# TODO: waiting for bun to support coverage report formats
#- name: Update Coverage Badge
# # GitHub actions: default branch variable
# # https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable
# if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
# uses: we-cli/coverage-badge-action@main
run: bun test --coverage --coverage-reporter lcov --coverage-dir coverage

# generate coverage-summary.json from lcov.info
- name: Generate Coverage Summary
run: lcov-parse ./coverage/lcov.info > coverage/coverage-summary.json

# requires ./coverage/coverage-summary.json
- name: Update Coverage Badge
# GitHub actions: default branch variable
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: we-cli/coverage-badge-action@main
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Open <http://localhost:3000/> with your browser to see the result.

### Testing

[![cov](https://propromo-software.github.io/propromo.rest/badges/coverage.svg)](https://github.com/propromo-software/propromo.rest/actions/workflows/ci.yml)
[![cov](https://propromo-software.github.io/propromo.rest/badges/coverage.svg)](https://github.com/propromo-software/propromo.rest/actions)

```bash
bun test
Expand Down

0 comments on commit 81ff869

Please sign in to comment.