-
Notifications
You must be signed in to change notification settings - Fork 6
Speed up Docusaurus build #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4acd8ad
76e7654
39aca22
533dec9
7ec586b
6b332bf
26429c0
fa41d20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,27 +15,48 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| # Hosted GitHub runners have 7 GB of memory available, let's use 6 GB | ||
| # Hosted GitHub runners have 7 GB of memory available, swap handles brief peaks above this | ||
| NODE_OPTIONS: --max-old-space-size=6144 | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Add swap space | ||
| run: | | ||
| # Resize existing swap from default 4 GB to 14 GB | ||
| sudo swapoff /swapfile || true | ||
| sudo rm -f /swapfile | ||
| sudo fallocate -l 14G /swapfile | ||
| sudo chmod 600 /swapfile | ||
| sudo mkswap /swapfile | ||
| sudo swapon /swapfile | ||
| free -h | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | ||
| with: | ||
| node-version: '20' | ||
| node-version: '24' | ||
| cache: 'yarn' | ||
| cache-dependency-path: yarn.lock | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Cache Docusaurus build | ||
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | ||
| with: | ||
| path: | | ||
| .docusaurus | ||
| node_modules/.cache | ||
| key: docusaurus-${{ runner.os }}-${{ hashFiles('yarn.lock', 'docusaurus.config.ts', 'versions.json') }} | ||
| restore-keys: | | ||
| docusaurus-${{ runner.os }}- | ||
|
Comment on lines
+50
to
+58
|
||
|
|
||
| - name: Build | ||
| run: yarn build | ||
|
|
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,23 @@ const config: Config = { | |||||||||||||
| locales: ['en'], | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| future: { | ||||||||||||||
| v4: { | ||||||||||||||
| removeLegacyPostBuildHeadAttribute: true, | ||||||||||||||
| useCssCascadeLayers: true, | ||||||||||||||
| }, | ||||||||||||||
| experimental_faster: { | ||||||||||||||
| swcJsLoader: true, | ||||||||||||||
| swcJsMinimizer: true, | ||||||||||||||
| swcHtmlMinimizer: true, | ||||||||||||||
| lightningCssMinimizer: true, | ||||||||||||||
| rspackBundler: true, | ||||||||||||||
| rspackPersistentCache: true, | ||||||||||||||
| mdxCrossCompilerCache: true, | ||||||||||||||
| ssgWorkerThreads: true, | ||||||||||||||
| }, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| presets: [ | ||||||||||||||
| [ | ||||||||||||||
| 'classic', | ||||||||||||||
|
|
@@ -38,6 +55,9 @@ const config: Config = { | |||||||||||||
| editCurrentVersion: true, | ||||||||||||||
| editUrl: 'https://github.com/openremote/documentation/edit/main/', | ||||||||||||||
| docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi | ||||||||||||||
| ...(process.env.NODE_ENV === 'development' && { | ||||||||||||||
| onlyIncludeVersions: ['current'], | ||||||||||||||
| }), | ||||||||||||||
|
Comment on lines
+58
to
+60
|
||||||||||||||
| ...(process.env.NODE_ENV === 'development' && { | |
| onlyIncludeVersions: ['current'], | |
| }), | |
| ...(process.env.NODE_ENV === 'development' | |
| ? { onlyIncludeVersions: ['current'] } | |
| : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocating a fixed 14G swapfile can fail on
ubuntu-latestif there isn’t enough free disk after checkout and dependency install (leading to workflow failures). Consider sizing swap dynamically based on available disk space, or using a smaller/default swap increase to reduce the chance offallocatefailing.