Skip to content

Commit

Permalink
ci(v2): fail CI if build takes too much time (#4516)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
slorber authored Mar 25, 2021
1 parent 88a48a0 commit f761408
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/v2-build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'packages/docusaurus/**'

jobs:
lint:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/v2-build-time-perf.yml
Original file line number Diff line number Diff line change
@@ -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?
2 changes: 1 addition & 1 deletion packages/docusaurus/src/commands/clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
]);
}

0 comments on commit f761408

Please sign in to comment.