From 71f0a18295dae525c662648c2f8a35cb17db80c2 Mon Sep 17 00:00:00 2001 From: JanHoefelmeyer Date: Wed, 3 Jan 2024 06:32:08 +0100 Subject: [PATCH 1/2] fork-test-solution --- .github/workflows/coverage.yml | 25 +++++++++++-------------- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ coverage.yml | 24 ++++++++++++++++++++++++ test.yml | 27 +++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 coverage.yml create mode 100644 test.yml 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/coverage.yml b/coverage.yml new file mode 100644 index 0000000..de8a014 --- /dev/null +++ b/coverage.yml @@ -0,0 +1,24 @@ +name: Report Coverage + +on: + workflow_run: + workflows: ["Test"] + types: + - completed + +jobs: + report: + runs-on: ubuntu-latest + + permissions: + pull-requests: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: "Report Coverage" + uses: davelosert/vitest-coverage-report-action@v2 + diff --git a/test.yml b/test.yml new file mode 100644 index 0000000..eafc484 --- /dev/null +++ b/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 From c238ecfd844a7b1395af47d0c509718874cc9937 Mon Sep 17 00:00:00 2001 From: JanHoefelmeyer Date: Wed, 3 Jan 2024 06:35:00 +0100 Subject: [PATCH 2/2] Test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d5c64d1..ea864dd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@