-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infra: add vitest coverage report (#1015)
- Loading branch information
1 parent
14669c2
commit 2f7c495
Showing
4 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Report Coverage | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['Coverage'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
report: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Slugify variables | ||
uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 # v4.4.1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ github.event.workflow_run.id }} | ||
name: coverage-${{ env.GITHUB_HEAD_REF_SLUG }} | ||
path: coverage | ||
|
||
- name: Download main Artifacts | ||
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ github.event.workflow_run.id }} | ||
name: coverage-main | ||
path: coverage-main | ||
|
||
- name: Report Coverage | ||
uses: davelosert/vitest-coverage-report-action@7cb62972347776255c2333807d26c60110c0df45 # v2.3.0 | ||
with: | ||
json-summary-compare-path: coverage-main/coverage-summary.json |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Coverage | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
branch: | ||
- ${{ github.head_ref }} | ||
- 'main' | ||
|
||
permissions: | ||
# Required to checkout the code | ||
contents: read | ||
|
||
steps: | ||
- name: Slugify variables | ||
uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 # v4.4.1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 | ||
|
||
- name: Set node version to 20 | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: Install deps | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Test | ||
run: pnpm vitest --coverage | ||
|
||
- name: Upload Coverage | ||
if: ${{ matrix.branch != 'main' }} | ||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
with: | ||
name: coverage-${{ env.GITHUB_HEAD_REF_SLUG }} | ||
path: coverage | ||
|
||
- name: Upload main Coverage | ||
if: ${{ matrix.branch == 'main' }} | ||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
with: | ||
name: coverage-main | ||
path: coverage |
This file contains 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
This file contains 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