From ed14d12f308198d30a8cb70c45319fb8a3540253 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 17:00:41 +0200 Subject: [PATCH 1/8] Add CI check to prevent localized site memory leaks, see https://github.com/facebook/docusaurus/pull/10599 --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 145790cecd7a..df5d31438325 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,7 +43,9 @@ 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 From 1c38a90398b141bdbb4db980732f5b4224b41bf4 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 17:03:01 +0200 Subject: [PATCH 2/8] Add CI check to prevent localized site memory leaks, see https://github.com/facebook/docusaurus/pull/10599 --- .github/workflows/tests-e2e.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index db3e5b25533b..c430232a5969 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -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 From e2713030d794ee51d9bc85e669515a9aeb64d46c Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 17:15:37 +0200 Subject: [PATCH 3/8] Add CI check to prevent localized site memory leaks, see https://github.com/facebook/docusaurus/pull/10599 --- .github/workflows/tests-e2e.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index c430232a5969..ef9feadcc813 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -174,7 +174,7 @@ jobs: - name: Build test-website project # 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 + 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df5d31438325..0a4d3599521d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: 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 From 932e6aa60f2732edcfb2dfa8b69d5ce563df8280 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 17:27:46 +0200 Subject: [PATCH 4/8] add build perf checks --- .github/workflows/build-perf.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index 24953c270808..d93a3679f1a5 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -25,6 +25,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 +35,9 @@ jobs: name: Build Size Report timeout-minutes: 30 runs-on: ubuntu-latest + strategy: + matrix: + DOCUSAURUS_FASTER: ['true', 'false'] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -54,10 +58,18 @@ jobs: strip-hash: '\.([^;]\w{7})\.' minimum-change-threshold: 30 compression: none + comment-key: DOCUSAURUS_FASTER-${{ secrets.GITHUB_TOKEN }} + env: + DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} + + # Ensures build times stay under reasonable thresholds build-time: name: Build Time Perf timeout-minutes: 30 runs-on: ubuntu-latest + strategy: + matrix: + DOCUSAURUS_FASTER: ['true', 'false'] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -72,10 +84,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: 2 + env: + DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} # Ensure build with a warm cache does not increase too much - name: Build (warm cache) run: yarn build:website:fast timeout-minutes: 2 + env: + DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} + # TODO post a GitHub comment with build with perf warnings? From 1559dc69b002f6b24f42bfbaf37cea88d51bf14c Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 17:35:17 +0200 Subject: [PATCH 5/8] add build perf checks --- .github/workflows/build-perf.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index d93a3679f1a5..21a75bbb9fca 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -11,6 +11,7 @@ on: - main - docusaurus-v** paths: + - .github/workflows/build-perf.yml - package.json - yarn.lock - packages/** From e1ca2826d25e8ede4997b8b0ec11b74c6d4ef349 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 18:01:51 +0200 Subject: [PATCH 6/8] add build perf checks --- .github/workflows/build-perf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index 21a75bbb9fca..7acdf2ffd009 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -59,7 +59,7 @@ jobs: strip-hash: '\.([^;]\w{7})\.' minimum-change-threshold: 30 compression: none - comment-key: DOCUSAURUS_FASTER-${{ secrets.GITHUB_TOKEN }} + comment-key: DOCUSAURUS_FASTER-${{ secrets.DOCUSAURUS_FASTER }} env: DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} From 21c24ada85bcc945f62cde3336fa490fb11b7429 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 18:10:53 +0200 Subject: [PATCH 7/8] fix env --- .github/workflows/build-perf.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index 7acdf2ffd009..a832a2254175 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - DOCUSAURUS_FASTER: ['true', 'false'] + DOCUSAURUS_INFRA: ['SLOWER', 'FASTER'] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -59,9 +59,9 @@ jobs: strip-hash: '\.([^;]\w{7})\.' minimum-change-threshold: 30 compression: none - comment-key: DOCUSAURUS_FASTER-${{ secrets.DOCUSAURUS_FASTER }} + comment-key: DOCUSAURUS_INFRA_${{ secrets.DOCUSAURUS_INFRA }} env: - DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} + DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }} # Ensures build times stay under reasonable thresholds build-time: @@ -70,7 +70,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - DOCUSAURUS_FASTER: ['true', 'false'] + DOCUSAURUS_INFRA: ['SLOWER', 'FASTER'] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -87,13 +87,13 @@ jobs: run: yarn build:website:fast timeout-minutes: 2 env: - DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} + 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 env: - DOCUSAURUS_FASTER: ${{ matrix.DOCUSAURUS_FASTER }} + DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }} # TODO post a GitHub comment with build with perf warnings? From 6f15a393e8d28080f44320eee47a11d2bbc137f0 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 22 Oct 2024 18:25:26 +0200 Subject: [PATCH 8/8] change build time thresholds --- .github/workflows/build-perf.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index a832a2254175..ef5ad00d5aac 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -85,14 +85,14 @@ jobs: # Ensure build with a cold cache does not increase too much - name: Build (cold cache) run: yarn build:website:fast - timeout-minutes: 2 + 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' }}