Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test2 #30

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test"
name: 'Coverage Test'
on:
pull_request:

Expand All @@ -7,9 +7,9 @@ jobs:
runs-on: ubuntu-latest

permissions:
# Required to checkout the code
# Required to checkout the code.
contents: read
# Required to put a comment into the pull-request
# Required to put a comment into the pull-request.
pull-requests: write

steps:
Expand All @@ -22,6 +22,19 @@ jobs:
run: npm install
- name: "Test"
run: npx vitest --coverage
- name: "Report Coverage"
if: always() # Also generate the report if tests are failing
uses: davelosert/vitest-coverage-report-action@v2


- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > ./pr_number
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: test-results
path: |
test-results.json
coverage
pr_number
33 changes: 33 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Test Report'
on:
workflow_run:
workflows: ['Coverage Test']
types:
- completed
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Download workflow artifact
uses: dawidd6/[email protected]
with:
workflow: run-tests.yml
name: test-results
run_id: ${{ github.event.workflow_run.id }}
- name: Set pr number env
run: |
PR_NUMBER=$(cat pr_number)
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
- name: Test Report
uses: phoenix-actions/test-reporting@v12
id: test-report
with:
artifact: test-results
name: Mocha Tests
path: test-results.json
reporter: mocha-json
- name: c8 coverage report
uses: Nef10/[email protected]
with:
pr-number: ${{ env.PR_NUMBER }}
github-token: ${{ secrets.GITHUB_TOKEN }}