Fix jsr #39
Workflow file for this run
This file contains hidden or 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: Pull Request Tests | |
| on: | |
| pull_request: | |
| branches: ['**'] | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| test: | |
| name: Test on Node.js ${{ matrix.node-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [20.x, 22.x, 23.x, 24.x] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test:ci | |
| - name: Upload coverage reports to Codecov | |
| if: matrix.node-version == '20.x' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| flags: unittests,pr | |
| name: codecov-pr-${{ github.event.pull_request.number }} | |
| verbose: true | |
| - name: Comment PR with test results | |
| if: always() && matrix.node-version == '20.x' | |
| continue-on-error: true | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const jobStatus = '${{ job.status }}'; | |
| const nodeVersion = '${{ matrix.node-version }}'; | |
| const emoji = jobStatus === 'success' ? '✅' : '❌'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `${emoji} Tests completed on Node.js ${nodeVersion}: **${jobStatus}**` | |
| }); | |
| audit-examples: | |
| name: Audit Examples | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Audit examples | |
| run: npm run audit:examples | |
| pr-checks-summary: | |
| name: PR Checks Summary | |
| runs-on: ubuntu-latest | |
| needs: [test, audit-examples] | |
| if: always() | |
| steps: | |
| - name: Check if all tests passed | |
| run: | | |
| if [ "${{ needs.test.result }}" != "success" ] || [ "${{ needs.audit-examples.result }}" != "success" ]; then | |
| echo "❌ Some checks failed" | |
| exit 1 | |
| else | |
| echo "✅ All checks passed" | |
| fi |