diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 2520146..de8a014 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,27 +1,24 @@ -name: "Test" +name: Report Coverage + on: - pull_request: + workflow_run: + workflows: ["Test"] + types: + - completed jobs: - test: + report: runs-on: ubuntu-latest permissions: - # Required to checkout the code - contents: read - # Required to put a comment into the pull-request pull-requests: write steps: - uses: actions/checkout@v4 - - name: "Install Node" - uses: actions/setup-node@v3 + - uses: actions/download-artifact@v4 with: - node-version: "20.x" - - name: "Install Deps" - run: npm install - - name: "Test" - run: npx vitest --coverage + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} - name: "Report Coverage" - if: always() # Also generate the report if tests are failing uses: davelosert/vitest-coverage-report-action@v2 + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..eafc484 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: "Test" +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: "Install Node" + uses: actions/setup-node@v4 + with: + node-version: "20.x" + - name: "Install Deps" + run: npm install + - name: "Test" + run: npx vitest --coverage.enabled true + + - name: "Upload Coverage" + uses: actions/upload-artifact@v4 + with: + name: coverage + path: coverage diff --git a/README.md b/README.md index d5c64d1..ea864dd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@