performance.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. name: Performance
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. inputs:
  6. base:
  7. description: Baseline commit or branch
  8. required: true
  9. default: main
  10. type: string
  11. permissions:
  12. contents: read
  13. concurrency:
  14. group: performance-${{ github.ref }}
  15. cancel-in-progress: true
  16. jobs:
  17. performance:
  18. name: performance
  19. runs-on: macos-15
  20. timeout-minutes: 45
  21. steps:
  22. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
  23. with:
  24. path: candidate
  25. ref: ${{ github.event.pull_request.head.sha || github.sha }}
  26. persist-credentials: false
  27. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
  28. with:
  29. path: baseline
  30. ref: ${{ github.event.pull_request.base.sha || inputs.base }}
  31. persist-credentials: false
  32. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
  33. with:
  34. repository: KonghaYao/harness-perf-benchmark
  35. ref: 8ad1e09f7653d7e97b83b4f5b4d347ca2fa129c7
  36. path: benchmark
  37. persist-credentials: false
  38. - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
  39. with:
  40. version: 9.12.0
  41. package_json_file: candidate/package.json
  42. - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  43. with:
  44. node-version: 22.23.2
  45. package-manager-cache: false
  46. - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
  47. with:
  48. bun-version: 1.4.2
  49. - name: Build baseline
  50. working-directory: baseline
  51. run: |
  52. pnpm install --frozen-lockfile
  53. pnpm build
  54. - name: Build candidate
  55. working-directory: candidate
  56. run: |
  57. pnpm install --frozen-lockfile
  58. pnpm build
  59. - name: Install pinned benchmark
  60. working-directory: benchmark
  61. run: bun install --frozen-lockfile
  62. - name: Compare on this runner
  63. run: node candidate/scripts/perf/run.mjs --base baseline --head candidate --benchmark benchmark --out "$RUNNER_TEMP/performance"
  64. - name: Upload performance evidence
  65. if: ${{ always() }}
  66. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
  67. with:
  68. name: performance-${{ github.run_attempt }}
  69. path: ${{ runner.temp }}/performance/
  70. include-hidden-files: true
  71. retention-days: 14
  72. if-no-files-found: warn