Skip to content

Commit dc3ed88

Browse files
committed
Added build caching and build watch paths for Workers and updated the same pages for Pages
1 parent ccfc092 commit dc3ed88

File tree

10 files changed

+154
-40
lines changed

10 files changed

+154
-40
lines changed

src/content/docs/pages/ci-cd/builds/build-caching.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To enable build caching in the Cloudflare dashboard:
1818
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
1919
2. In Account Home, select **Workers & Pages**.
2020
3. In **Overview**, select your Pages project.
21-
4. Go to **Settings** > **Builds & deployments** > **Build cache** and select **Enable build cache**.
21+
4. Go to **Settings** > **Build** > **Build cache** and select **Enable**.
2222

2323
### Clear cache
2424

@@ -27,8 +27,8 @@ The build cache can be cleared for a project if needed, such as when debugging b
2727
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2828
2. In Account Home, select **Workers & Pages**.
2929
3. In **Overview**, select your Pages project.
30-
4. Go to **Settings** > **Builds & deployments** > **Build cache**.
31-
5. Select **Clear cache** to clear the build cache.
30+
4. Go to **Settings** > **Build** > **Build cache**.
31+
5. Select **Clear Cache** to clear the build cache.
3232

3333
## How build caching works
3434

@@ -58,11 +58,7 @@ Caching the build output from frameworks can speed up subsequent build times. Th
5858

5959
## Limits
6060

61-
During this beta period, the following limits are imposed:
61+
The following limits are imposed for build caching:
6262

6363
- **Retention**: Cache is purged seven days after its last read date. Unread cache artifacts are purged seven days after creation.
6464
- **Storage**: Every project is allocated 10 GB. If the project cache exceeds this limit, the project will automatically start deleting artifacts that were read least recently.
65-
66-
## Feedback
67-
68-
If there are package managers or frameworks you want to see supported, let us know in the Pages channel of the [Cloudflare Developer Discord](https://discord.com/invite/cloudflaredev).
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
---
22
pcx_content_type: concept
33
title: Build watch paths
4-
54
---
65

76
When you connect a git repository to Pages, by default a change to any file in the repository will trigger a Pages build. You can configure Pages to include or exclude specific paths to specify if Pages should skip a build for a given path. This can be especially helpful if you are using a monorepo project structure and want to limit the amount of builds being kicked off.
87

98
## Configure paths
109

11-
To configure which paths are included and excluded, go to your Pages project > Settings > Builds & deployments > Build watch paths. Pages will default to setting your project’s includes paths to everything (\[\*]) and excludes paths to nothing (`[]`).
10+
To configure which paths are included and excluded:
11+
12+
1. In **Overview**, select your Pages project.
13+
2. Go to **Settings** > **Build** > **Build watch paths**. Pages will default to setting your project’s includes paths to everything (\[\*]) and excludes paths to nothing (`[]`).
1214

1315
The configuration fields can be filled in two ways:
1416

15-
* **Static filepaths**: Enter the precise name of the file you are looking to include or exclude (for example, `docs/README.md`).
16-
* **Wildcard syntax:** Use wildcards to match multiple path directories. You can specify wildcards at the start or end of your rule.
17+
- **Static filepaths**: Enter the precise name of the file you are looking to include or exclude (for example, `docs/README.md`).
18+
- **Wildcard syntax:** Use wildcards to match multiple path directories. You can specify wildcards at the start or end of your rule.
1719

1820
:::note[Wildcard syntax]
1921

20-
2122
A wildcard (`*`) is a character that is used within rules. It can be placed alone to match anything or placed at the start or end of a rule to allow for better control over branch configuration. A wildcard will match zero or more characters.For example, if you wanted to match all branches that started with `fix/` then you would create the rule `fix/*` to match strings like `fix/1`, `fix/bugs`or `fix/`.
2223

23-
2424
:::
2525

2626
For each path in a push event, build watch paths will be evaluated as follows:
2727

28-
* Paths satisfying excludes conditions are ignored first
29-
* Any remaining paths are checked against includes conditions
30-
* If any matching path is found, a build is triggered. Otherwise the build is skipped
28+
- Paths satisfying excludes conditions are ignored first
29+
- Any remaining paths are checked against includes conditions
30+
- If any matching path is found, a build is triggered. Otherwise the build is skipped
3131

3232
Pages will bypass the path matching for a push event and default to building the project if:
3333

34-
* A push event contains 0 file changes, in case a user pushes a empty push event to trigger a build
35-
* A push event contains 3000+ file changes or 20+ commits
34+
- A push event contains 0 file changes, in case a user pushes a empty push event to trigger a build
35+
- A push event contains 3000+ file changes or 20+ commits
3636

3737
## Examples
3838

3939
### Example 1
4040

4141
If you want to trigger a build from all changes within a set of directories, such as all changes in the folders `project-a/` and `packages/`
4242

43-
* Include paths: `project-a/*, packages/*`
44-
* Exclude paths: \`\`
43+
- Include paths: `project-a/*, packages/*`
44+
- Exclude paths: \`\`
4545

4646
### Example 2
4747

4848
If you want to trigger a build for any changes, but want to exclude changes to a certain directory, such as all changes in a docs/ directory
4949

50-
* Include paths: `*`
51-
* Exclude paths: `docs/*`
50+
- Include paths: `*`
51+
- Exclude paths: `docs/*`
5252

5353
### Example 3
5454

5555
If you want to trigger a build for a specific file or specific filetype, for example all files ending in `.md`.
5656

57-
* Include paths: `*.md`
58-
* Exclude paths: \`\`
57+
- Include paths: `*.md`
58+
- Exclude paths: \`\`

src/content/docs/workers/ci-cd/builds/advanced-setups.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pcx_content_type: reference
33
title: Advanced Setups
44
description: Learn how to use Workers Builds with more advanced setups
55
sidebar:
6-
order: 5
6+
order: 7
77
---
88

99
## Monorepos
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
pcx_content_type: concept
3+
title: Build caching
4+
description: Improve build times by caching build outputs and dependencies
5+
sidebar:
6+
order: 5
7+
---
8+
9+
Improve Workers Builds build times by turning on build caching to restore dependencies and build output between builds. The first build to occur after enabling build caching on your Pages project will save to cache. Every subsequent build will restore from cache unless configured otherwise.
10+
11+
## Configuration
12+
13+
### Enable build caching
14+
15+
To enable build caching in the Cloudflare dashboard:
16+
17+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
18+
2. In Account Home, select **Workers & Pages**.
19+
3. In **Overview**, select your Workers project.
20+
4. Go to **Settings** > **Build** > **Build cache** and select **Enable**.
21+
22+
### Clear cache
23+
24+
The build cache can be cleared for a project when needed, such as when debugging build issues. To clear the build cache:
25+
26+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
27+
2. In Account Home, select **Workers & Pages**.
28+
3. In **Overview**, select your Workers project.
29+
4. Go to **Settings** > **Build** > **Build cache**.
30+
5. Select **Clear Cache** to clear the build cache.
31+
32+
## How build caching works
33+
34+
When enabled, build caching will automatically detect which package manager and framework the project is using from its `package.json` and cache data accordingly for the build.
35+
36+
The following shows which package managers and frameworks are supported for dependency and build output caching respectively.
37+
38+
### Package managers
39+
40+
Workers build cache will cache the global cache directories of the following package managers:
41+
42+
- [yarn](https://yarnpkg.com/)
43+
- [npm](https://www.npmjs.com/)
44+
- [pnpm](https://pnpm.io/)
45+
- [node.js](https://nodejs.org/)
46+
47+
### Frameworks
48+
49+
The following frameworks support build output caching:
50+
51+
| Framework | Directories cached |
52+
| ---------- | --------------------------------------------- |
53+
| Astro | `node_modules/.astro` |
54+
| Docusaurus | `node_modules/.cache`, `.docusaurus`, `build` |
55+
| Eleventy | `.cache` |
56+
| Gatsby | `.cache`, `public` |
57+
| Next.js | `.next/cache` |
58+
| Nuxt | `node_modules/.cache/nuxt` |
59+
60+
:::note
61+
[Static assets](/workers/static-assets/) and [frameworks](/workers/frameworks/) are now supported in Cloudflare Workers.
62+
:::
63+
64+
## Limits
65+
66+
The following limits are imposed for build caching:
67+
68+
- **Retention**: Cache is purged 7 days after its last read date. Unread cache artifacts are purged 7 days after creation.
69+
- **Storage**: Every project is allocated 10 GB. If the project cache exceeds this limit, the project will automatically start deleting artifacts that were read least recently.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
pcx_content_type: concept
3+
title: Build watch paths
4+
description: Reduce compute for your monorepo by specifying paths for Workers Builds to skip
5+
sidebar:
6+
order: 6
7+
---
8+
9+
When you connect a git repository to Workers, by default a change to any file in the repository will trigger a build. You can configure Workers to include or exclude specific paths to specify if Workers should skip a build for a given path. This can be especially helpful if you are using a monorepo project structure and want to limit the amount of builds being kicked off.
10+
11+
## Configure paths
12+
13+
To configure which paths are included and excluded:
14+
15+
1. In **Overview**, select your Workers project.
16+
2. Go to **Settings** > **Build** > **Build watch paths**. Workers will default to setting your project’s includes paths to everything (\[\*]) and excludes paths to nothing (`[]`).
17+
18+
The configuration fields can be filled in two ways:
19+
20+
- **Static filepaths**: Enter the precise name of the file you are looking to include or exclude (for example, `docs/README.md`).
21+
- **Wildcard syntax:** Use wildcards to match multiple path directories. You can specify wildcards at the start or end of your rule.
22+
23+
:::note[Wildcard syntax]
24+
25+
A wildcard (`*`) is a character that is used within rules. It can be placed alone to match anything or placed at the start or end of a rule to allow for better control over branch configuration. A wildcard will match zero or more characters.For example, if you wanted to match all branches that started with `fix/` then you would create the rule `fix/*` to match strings like `fix/1`, `fix/bugs`or `fix/`.
26+
27+
:::
28+
29+
For each path in a push event, build watch paths will be evaluated as follows:
30+
31+
- Paths satisfying excludes conditions are ignored first
32+
- Any remaining paths are checked against includes conditions
33+
- If any matching path is found, a build is triggered. Otherwise the build is skipped
34+
35+
Workers will bypass the path matching for a push event and default to building the project if:
36+
37+
- A push event contains 0 file changes, in case a user pushes a empty push event to trigger a build
38+
- A push event contains 3000+ file changes or 20+ commits
39+
40+
## Examples
41+
42+
### Example 1
43+
44+
If you want to trigger a build from all changes within a set of directories, such as all changes in the folders `project-a/` and `packages/`
45+
46+
- Include paths: `project-a/*, packages/*`
47+
- Exclude paths: \`\`
48+
49+
### Example 2
50+
51+
If you want to trigger a build for any changes, but want to exclude changes to a certain directory, such as all changes in a docs/ directory
52+
53+
- Include paths: `*`
54+
- Exclude paths: `docs/*`
55+
56+
### Example 3
57+
58+
If you want to trigger a build for a specific file or specific filetype, for example all files ending in `.md`.
59+
60+
- Include paths: `*.md`
61+
- Exclude paths: \`\`

src/content/docs/workers/ci-cd/builds/index.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ pcx_content_type: concept
33
title: Builds
44
description: Use Workers Builds to integrate with Git and automatically build and deploy your Worker when you merge a pull request
55
sidebar:
6-
<<<<<<< HEAD
7-
badge:
8-
text: Beta
9-
=======
106
group:
117
badge:
128
text: Beta
13-
>>>>>>> 512d7f3090a82fbd18235a6ab7048a7378feb0e4
149
---
1510

1611
Workers Builds allows you to connect an existing Worker to a GitHub or GitLab repository to set up automatic builds and deployments for your development workflow. Creating a new Worker from a git repository will be supported soon.

src/content/docs/workers/ci-cd/builds/limits-and-pricing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pcx_content_type: concept
33
title: Limits & Pricing
44
description: Limits & pricing for Workers Builds
55
sidebar:
6-
order: 6
6+
order: 8
77
---
88

99
## Limits

src/content/docs/workers/ci-cd/builds/troubleshoot.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pcx_content_type: troubleshooting
33
title: Troubleshooting
44
description: Learn about troubleshooting and known issues in Workers Builds.
55
sidebar:
6-
order: 7
6+
order: 9
77
---
88

99
Workers Builds provides build logs for every build started. You can view build logs by navigating to your **Worker project** > **Deployments** > **View Build History** > **View Build**.

src/content/docs/workers/ci-cd/index.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ pcx_content_type: concept
33
title: CI/CD
44
description: Set up continuous integration and continuous deployment for your Workers.
55
sidebar:
6-
<<<<<<< HEAD
7-
order: 7
8-
=======
96
order: 8
10-
>>>>>>> 512d7f3090a82fbd18235a6ab7048a7378feb0e4
117
---
128

139
You can set up continuous integration and continuous deployment (CI/CD) for your Workers by using either the native build system, [Workers Builds](#workers-builds), or using [external providers](#external-cicd) to optimize your development workflow.

src/content/docs/workers/configuration/versions-and-deployments/index.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Using versions and deployments is useful if:
1616
- You are running critical applications on Workers and want to reduce risk when deploying new versions of your Worker using a rolling deployment strategy.
1717
- You want to monitor for performance differences when deploying new versions of your Worker.
1818
- You have a CI/CD pipeline configured for Workers but want to cut manual releases.
19-
<<<<<<< HEAD
20-
=======
2119

2220
:::note
2321

@@ -26,7 +24,6 @@ Versions and deployments are in **beta and under active development**. Refer to
2624
Provide your feedback on versions and deployments through the [feedback form](https://www.cloudflare.com/lp/developer-week-deployments).
2725

2826
:::
29-
>>>>>>> 512d7f3090a82fbd18235a6ab7048a7378feb0e4
3027

3128
## Versions
3229

0 commit comments

Comments
 (0)