Skip to content

Studio: Improve performance for create site #2806

Studio: Improve performance for create site

Studio: Improve performance for create site #2806

name: Performance Metrics Comparison
on:
pull_request:
push:
branches: [trunk]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
metrics:
name: Run metrics tests
runs-on: macos-15
permissions:
contents: read
env:
ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FORCE_COLOR: '1'
CODEVITALS_AUTH_TOKEN: ${{ secrets.CODEVITALS_AUTH_TOKEN }}
SKIP_WORKER_THREAD_BUILD: 'true'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: '.nvmrc'
- name: Compare performance with trunk
if: github.event_name == 'pull_request'
run: cd scripts/compare-perf && npm ci && npm run compare -- perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA
- name: Compare performance with base branch
if: github.event_name == 'push'
# The base hash used here need to be a commit that is compatible with the current performance tests.
# The current one is d1f49275f3e08fb675d5685855c2243b6cd183de
# it needs to be updated every time it becomes unsupported by the current performance tests.
# It is used as a base comparison point to avoid fluctuation in the performance metrics.
run: |
cd scripts/compare-perf && npm ci && npm run compare -- perf $GITHUB_SHA d1f49275f3e08fb675d5685855c2243b6cd183de --tests-branch $GITHUB_SHA
# Log performance metrics to CodeVitals when running on trunk
- name: Log performance metrics to CodeVitals
if: github.event_name == 'push' && github.ref == 'refs/heads/trunk' && !cancelled()
run: |
COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%cI")
npm ci && cd scripts/compare-perf && npm run log-to-codevitals -- $CODEVITALS_AUTH_TOKEN trunk $GITHUB_SHA d1f49275f3e08fb675d5685855c2243b6cd183de $COMMITTED_AT
- name: Archive performance results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: performance-results
path: ${{ env.ARTIFACTS_PATH }}