feat[ci]: run tests and report coverage for PR #5
Workflow file for this run
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
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 |