|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + pull_request: |
| 6 | + branches: [main] |
| 7 | +jobs: |
| 8 | + lint: |
| 9 | + name: Lint |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout repository |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Set up workspace |
| 16 | + uses: ./.github/actions/setup |
| 17 | + |
| 18 | + - name: Run linter |
| 19 | + run: npm run lint |
| 20 | + |
| 21 | + test-node: |
| 22 | + name: Test on Node.js ${{ matrix.node-version }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + node-version: ["0.10", "0.12", 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Set up workspace |
| 33 | + uses: ./.github/actions/setup |
| 34 | + with: |
| 35 | + node-version: ${{ matrix.node-version }} |
| 36 | + |
| 37 | + - name: Run tests |
| 38 | + run: npm run test-node |
| 39 | + |
| 40 | + test-browser: |
| 41 | + name: Test in browser |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: Checkout repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up workspace |
| 48 | + uses: ./.github/actions/setup |
| 49 | + |
| 50 | + - name: Install browsers |
| 51 | + run: npx playwright install --with-deps |
| 52 | + |
| 53 | + - name: Run tests |
| 54 | + run: npm run test-browser |
| 55 | + |
| 56 | + benchmark: |
| 57 | + name: Benchmark |
| 58 | + runs-on: ubuntu-latest |
| 59 | + permissions: |
| 60 | + # To deploy GitHub pages website. |
| 61 | + deployments: write |
| 62 | + # To update benchmark contents in gh-pages branch. |
| 63 | + contents: write |
| 64 | + steps: |
| 65 | + - name: Checkout repository |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Set up workspace |
| 69 | + uses: ./.github/actions/setup |
| 70 | + |
| 71 | + - name: Install browsers |
| 72 | + run: npx playwright install --with-deps |
| 73 | + |
| 74 | + - name: Run benchmark |
| 75 | + run: npm run benchmark | tee benchmark.txt |
| 76 | + |
| 77 | + - name: Download previous benchmark data |
| 78 | + uses: actions/cache@v4 |
| 79 | + with: |
| 80 | + path: ./cache |
| 81 | + key: ${{ runner.os }}-benchmark |
| 82 | + |
| 83 | + - name: Store benchmark result |
| 84 | + uses: benchmark-action/github-action-benchmark@v1 |
| 85 | + with: |
| 86 | + tool: benchmarkjs |
| 87 | + output-file-path: benchmark.txt |
| 88 | + external-data-json-path: ./cache/benchmark-data.json |
| 89 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + alert-threshold: 150% |
| 91 | + comment-on-alert: true |
| 92 | + fail-on-alert: true |
| 93 | + alert-comment-cc-users: "@Stuk" |
0 commit comments