-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
99 lines (91 loc) · 4.12 KB
/
build-perf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Build Performance
on:
# Note! you can't safely use "pull_request_target" here
# This workflow is mostly useful for "internal PRs"
# External PRs won't be able to post a PR comment
# See https://github.com/preactjs/compressed-size-action/issues/54
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests
pull_request:
branches:
- main
- docusaurus-v**
paths:
- .github/workflows/build-perf.yml
- package.json
- yarn.lock
- packages/**
- website/**
- '!website/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
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
contents: read # for actions/checkout to fetch code
issues: write # for preactjs/compressed-size-action to create comments
pull-requests: write # for preactjs/compressed-size-action to write a PR review
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
- name: Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: yarn
- name: Track build size changes
uses: preactjs/compressed-size-action@6fa0e7ca017120c754863b31123c5ee2860fd434 # v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-script: build:website:fast
clean-script: clear:website # see https://github.com/facebook/docusaurus/pull/6838
pattern: '{website/build/assets/js/main*js,website/build/assets/js/runtime~main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/.docusaurus/registry.js,website/.docusaurus/routes.js,website/.docusaurus/routesChunkNames.json,website/.docusaurus/site-metadata.json,website/.docusaurus/codeTranslations.json,website/.docusaurus/i18n.json,website/.docusaurus/docusaurus.config.mjs,website/build/index.html,website/build/docs.html,website/build/docs/**/*.html,website/build/blog.html,website/build/blog/**/*.html}'
# HTML files: exclude versioned docs pages, tags pages, html redirect files
exclude: '{website/build/docs/?.?.?/**/*.html,website/build/docs/next/**/*.html,website/build/blog/tags/**/*.html,**/*.html.html}'
strip-hash: '\.([^;]\w{7})\.'
minimum-change-threshold: 30
compression: none
comment-key: DOCUSAURUS_INFRA_${{ matrix.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
- name: Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: yarn
- name: Installation
run: yarn || yarn || yarn
# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
run: yarn build:website:fast
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: 1
env:
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
# TODO post a GitHub comment with build with perf warnings?