Skip to content

feat(test): Dashboard tests #1982

feat(test): Dashboard tests

feat(test): Dashboard tests #1982

name: PR - coverage annotation
on:
pull_request:
branches:
- main
jobs:
coverage-report:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get run ID of Code Climate workflow
id: get-run-id
env:
GH_TOKEN: ${{ github.token }}
run: |
WF_NAME="Code Climate Report"
RUN_ID=`gh run list --workflow "${WF_NAME}" --json databaseId --jq .[0].databaseId`
echo "Detected latest run id of ${RUN_ID} for workflow ${WF_NAME}"
echo "run-id=${RUN_ID}" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
if: steps.get-run-id.conclusion == 'success'
id: get-main-coverage
with:
name: main-coverage
path: main-coverage
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.get-run-id.outputs.run-id }}
- name: Test
if: always()
id: test
continue-on-error: true
run: run test --coverage
- name: Report Coverage (compared with Main)
if: steps.get-main-coverage.conclusion == 'success'
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-compare-path: main-coverage/coverage-summary.json
- name: Report Coverage (only PR)
if: steps.get-main-coverage.conclusion == 'failure' || steps.get-main-coverage.conclusion == 'skipped'
uses: davelosert/vitest-coverage-report-action@v2
outputs:
actualResult: ${{ steps.test.conclusion }}