diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 997e44a..f74e77f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,12 +4,6 @@ on: branches: - ci-test - master - workflow_dispatch: - inputs: - logLevel: - description: 'Log level' - required: true - default: 'warning' jobs: deploy: @@ -43,4 +37,3 @@ jobs: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} run: | yarn deploy - diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..e881048 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,51 @@ +name: PR tests +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + branch: + - ${{ github.head_ref }} + - "main" + + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + - name: "Install Node" + uses: actions/setup-node@v4 + with: + node-version: "20" + - 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: + - name: "Download Coverage Artifacts" + uses: actions/download-artifact@v4 + with: + name: coverage-${{ github.head_ref }} + path: coverage + - uses: actions/download-artifact@v4 + with: + name: coverage-main + path: coverage-main + - name: "Report Coverage" + uses: davelosert/vitest-coverage-report-action@v2 + with: + json-summary-compare-path: coverage-main/coverage-summary.json diff --git a/vite.config.js b/vite.config.js index 9633a17..f36be7e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -6,7 +6,7 @@ const cfg = defineWorkersConfig({ test: { coverage: { provider: "istanbul", // v8 is not supported due for cf workers - reporter: ["text", "json", "html"], + reporter: ["text", "json", "html", "json-summary"], }, poolOptions: { workers: {