Code Coverage Report #304
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Coverage Report | |
on: | |
push: | |
branches: | |
- main # run this whenever someone merged into main | |
schedule: | |
- cron: "30 01 * * *" # run this every morning at 1:30 | |
workflow_dispatch: # allow manual triggering workflow | |
# ensures that currently running Code Coverage Report workflow is canceled if another job starts | |
concurrency: | |
group: ${{ github.workflow }}-main | |
cancel-in-progress: true | |
# this action needs the same permissions as the Push to GitHub Pages action because it is calling it | |
permissions: | |
actions: read | |
contents: write | |
jobs: | |
coverage-report: | |
runs-on: ubuntu-latest | |
env: | |
JSON_ARTIFACT_ID: json-main-coverage-report | |
HTML_ARTIFACT_ID: html-main-coverage-report | |
outputs: | |
json_artifact_id: ${{ env.JSON_ARTIFACT_ID }} | |
html_artifact_id: ${{ env.HTML_ARTIFACT_ID }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
#### this is our set up for installing and running the tests, update this with your set up and test run #### | |
- uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Tests | |
continue-on-error: true | |
run: pnpm exec vitest --coverage | |
#### end set up and test run #### | |
- name: Upload Coverage Summary | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
id: upload-json | |
with: | |
name: ${{ env.JSON_ARTIFACT_ID }} | |
# path should point to the location of your json coverage report | |
path: coverage/coverage-summary.json | |
overwrite: true | |
retention-days: 90 | |
- name: Upload Coverage Report | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
id: upload-html | |
with: | |
name: ${{ env.HTML_ARTIFACT_ID }} | |
# path should point to the location of your html coverage report | |
path: coverage/html-report/* | |
overwrite: true | |
retention-days: 90 | |
publish: | |
needs: [coverage-report] | |
# call the push-to-gh-pages workflow to add the artifacts to gh-pages | |
uses: ./.github/workflows/push-to-gh-pages.yml | |
with: | |
FILE_1_ARTIFACT_ID: ${{ needs.coverage-report.outputs.json_artifact_id }} | |
FILE_1_DEPLOY_TO: _data/coverage/ | |
FILE_2_ARTIFACT_ID: ${{ needs.coverage-report.outputs.html_artifact_id }} | |
FILE_2_DEPLOY_TO: coverage/ | |
COMMIT_MSG: update code coverage report for main | |
URL_PATH: coverage/ | |
secrets: inherit # allow called workflow to use GitHub secrets |