-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat[ci]: run tests and report coverage for PR
- Loading branch information
Showing
2 changed files
with
70 additions
and
25 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
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,61 @@ | ||
name: PR tests | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
branch: | ||
- ${{ github.head_ref }} | ||
- "master" | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
|
||
- name: "Install Node" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "yarn" | ||
|
||
- name: "Install Deps" | ||
run: yarn install | ||
|
||
- name: "Test" | ||
run: yarn coverage | ||
|
||
- name: "Upload Coverage" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-${{ matrix.branch }} | ||
path: coverage | ||
|
||
report-coverage: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Download HEAD coverage artifacts" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage-${{ github.head_ref }} | ||
path: coverage | ||
|
||
- name: "Download master coverage artifacts" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage-master | ||
path: coverage-master | ||
|
||
- name: "Report Coverage" | ||
uses: davelosert/vitest-coverage-report-action@v2 | ||
with: | ||
json-summary-compare-path: coverage-master/coverage-summary.json |