mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +02:00
perf(ci): Add CI checks to prevent memory, build-time and build-size regressions (#10601)
This commit is contained in:
parent
dbdd254c51
commit
d3f110cc03
3 changed files with 36 additions and 8 deletions
22
.github/workflows/build-perf.yml
vendored
22
.github/workflows/build-perf.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
|||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- .github/workflows/build-perf.yml
|
||||
- package.json
|
||||
- yarn.lock
|
||||
- packages/**
|
||||
|
@ -25,6 +26,7 @@ permissions:
|
|||
contents: read
|
||||
|
||||
jobs:
|
||||
# Posts a PR comment with build size differences from PR vs main branches
|
||||
build-size:
|
||||
permissions:
|
||||
checks: write # for preactjs/compressed-size-action to create and update the checks
|
||||
|
@ -34,6 +36,9 @@ jobs:
|
|||
name: Build Size Report
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -54,10 +59,18 @@ jobs:
|
|||
strip-hash: '\.([^;]\w{7})\.'
|
||||
minimum-change-threshold: 30
|
||||
compression: none
|
||||
comment-key: DOCUSAURUS_INFRA_${{ secrets.DOCUSAURUS_INFRA }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# Ensures build times stay under reasonable thresholds
|
||||
build-time:
|
||||
name: Build Time Perf
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -72,10 +85,15 @@ jobs:
|
|||
# Ensure build with a cold cache does not increase too much
|
||||
- name: Build (cold cache)
|
||||
run: yarn build:website:fast
|
||||
timeout-minutes: 8
|
||||
timeout-minutes: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 3 || 1 }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# Ensure build with a warm cache does not increase too much
|
||||
- name: Build (warm cache)
|
||||
run: yarn build:website:fast
|
||||
timeout-minutes: 2
|
||||
timeout-minutes: 1
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
|
||||
# TODO post a GitHub comment with build with perf warnings?
|
||||
|
|
16
.github/workflows/tests-e2e.yml
vendored
16
.github/workflows/tests-e2e.yml
vendored
|
@ -62,7 +62,9 @@ jobs:
|
|||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: yarn build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
|
@ -133,7 +135,9 @@ jobs:
|
|||
yarn typecheck
|
||||
|
||||
- name: Build test-website project
|
||||
run: yarn build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
|
@ -168,7 +172,9 @@ jobs:
|
|||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: npm run build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: npm run build -- --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
|
@ -206,7 +212,9 @@ jobs:
|
|||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
run: pnpm run build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: pnpm run build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
|
|
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
|
@ -43,11 +43,13 @@ jobs:
|
|||
- name: Remove Theme Internal Re-export
|
||||
run: yarn workspace @docusaurus/theme-common removeThemeInternalReexport
|
||||
- name: Docusaurus Build
|
||||
run: yarn build:website:fast
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build:website:fast --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=350'
|
||||
NODE_OPTIONS: '--max-old-space-size=400'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
- name: Docusaurus site CSS order
|
||||
run: yarn workspace website test:css-order
|
||||
|
|
Loading…
Add table
Reference in a new issue