diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 504b2df..1813416 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,14 @@ jobs: - name: Setup Bun Environment uses: oven-sh/setup-bun@v1 with: - bun-version: 1.1.6 + bun-version: 1.1.17 - name: Install dependencies - run: bun install + run: | + bun install + bun install lcov-parse + # outputs coverage/lcov.info - name: Run tests env: DEV_MODE: true @@ -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 diff --git a/README.md b/README.md index 932db4d..f726dde 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Open 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