|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + branches: [main, master] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-and-test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + timeout-minutes: 15 |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: 20 |
| 22 | + |
| 23 | + - name: Enable pnpm |
| 24 | + run: corepack enable pnpm |
| 25 | + |
| 26 | + - name: Get pnpm store directory |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 30 | +
|
| 31 | + - name: Setup pnpm cache |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: ${{ env.STORE_PATH }} |
| 35 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 36 | + restore-keys: | |
| 37 | + ${{ runner.os }}-pnpm-store- |
| 38 | +
|
| 39 | + - name: Install dependencies |
| 40 | + run: pnpm install --frozen-lockfile |
| 41 | + |
| 42 | + - name: Build |
| 43 | + run: pnpm -r build |
| 44 | + |
| 45 | + - name: Test |
| 46 | + run: pnpm -r test |
| 47 | + |
| 48 | + benchmark: |
| 49 | + needs: build-and-test |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 10 |
| 52 | + if: github.event_name == 'pull_request' |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Setup Node.js |
| 59 | + uses: actions/setup-node@v4 |
| 60 | + with: |
| 61 | + node-version: 20 |
| 62 | + |
| 63 | + - name: Enable pnpm |
| 64 | + run: corepack enable pnpm |
| 65 | + |
| 66 | + - name: Install dependencies |
| 67 | + run: pnpm install --frozen-lockfile |
| 68 | + |
| 69 | + - name: Build |
| 70 | + run: pnpm -r build |
| 71 | + |
| 72 | + - name: Run benchmark |
| 73 | + run: pnpm --filter @site-compiler/eval-benchmark test |
| 74 | + |
| 75 | + - name: Post benchmark results |
| 76 | + if: always() |
| 77 | + uses: actions/github-script@v7 |
| 78 | + with: |
| 79 | + script: | |
| 80 | + const fs = require('fs'); |
| 81 | + const body = '## Benchmark Results\n\nBenchmark tests completed. Check the test output above for detailed results.'; |
| 82 | + github.rest.issues.createComment({ |
| 83 | + issue_number: context.issue.number, |
| 84 | + owner: context.repo.owner, |
| 85 | + repo: context.repo.repo, |
| 86 | + body |
| 87 | + }); |
0 commit comments