ci(v2): fail CI if build takes too much time (#4516)

* remove the .cache folder so that it removes both webpack cache-loader-v4/persistent-cache-v5 + webpack terser cache

* Add GH action to track build time perf with a timeout

* Add GH action to track build time perf with a timeout
This commit is contained in:
Sébastien Lorber 2021-03-25 17:30:49 +01:00 committed by GitHub
parent 88a48a072a
commit f7614081dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

View file

@ -9,7 +9,7 @@ on:
- 'packages/docusaurus/**'
jobs:
lint:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:

View file

@ -0,0 +1,35 @@
name: V2 Build Time Perf
on:
pull_request:
branches:
- master
paths-ignore:
- 'website/docs/**'
- 'website-1.x/**'
- 'packages/docusaurus-1.x/**'
- 'packages/docusaurus-init-1.x/**'
jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
run: yarn workspace docusaurus-2-website build
timeout-minutes: 10
# Ensure build with a warm cache does not increase too much
- name: Build (warm cache)
run: yarn workspace docusaurus-2-website build
timeout-minutes: 10
# TODO post a Github comment with build with perf warnings?

View file

@ -25,6 +25,6 @@ export default async function clear(siteDir: string): Promise<unknown> {
return Promise.all([
removePath(path.join(siteDir, GENERATED_FILES_DIR_NAME)),
removePath(path.join(siteDir, DEFAULT_BUILD_DIR_NAME)),
removePath(path.join(siteDir, 'node_modules/.cache/cache-loader')),
removePath(path.join(siteDir, 'node_modules', '.cache')),
]);
}