Skip to content

Commit 649e763

Browse files
authored
cache + speedup windows e2e (#5654)
* cache + speedup windows e2e * fix README * Merge prerelease jobs * Run tests on PRs * Fix turborepo * Cache changesets * Use turbo for create-cloudflare publishing
1 parent 906c39a commit 649e763

15 files changed

+65
-229
lines changed

.github/workflows/README.md

+4-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ See below for a summary of this repo's Actions
66

77
## PR related actions
88

9-
### Pull Request (pullrequests.yml)
9+
### Tests + Checks (test-and-check.yml)
1010

1111
- Triggers
1212
- Updates to PRs.
@@ -28,7 +28,7 @@ See below for a summary of this repo's Actions
2828
## Test old Node.js version (test-old-node-error.yml)
2929

3030
- Triggers
31-
- Updates to PRs.
31+
- Commits merged to the `changeset-release/main` branch.
3232
- Actions
3333
- Makes sure that Wrangler's warning for old Node.js versions works.
3434

@@ -75,15 +75,6 @@ See below for a summary of this repo's Actions
7575

7676
## Main branch actions
7777

78-
### Main branch (main.yml)
79-
80-
- Triggers
81-
- Commits merged to the `main` branch, on the Cloudflare fork.
82-
- Actions
83-
- Builds all the packages.
84-
- Runs formatting, linting and type checks.
85-
- Runs fixture tests, Wrangler unit tests, C3 unit tests, Miniflare unit tests, and ESLint + Prettier checks.
86-
8778
### Handle Changesets (changesets.yml)
8879

8980
- Triggers
@@ -94,12 +85,13 @@ See below for a summary of this repo's Actions
9485
- Public packages are deployed to npm
9586
- Private packages will run their `deploy` script, if they have one.
9687

97-
### Prerelease (prereleases.yml)
88+
### Publish @beta pre-releases (prereleases.yml)
9889

9990
- Triggers
10091
- Commits merged to the `main` branch, on the Cloudflare fork.
10192
- Actions
10293
- Publishes the `wrangler` package to npm under the `beta` dist-tag.
94+
- Publishes the `create-cloudflare` package to npm under the `beta` dist-tag.
10395

10496
## Product-specific branch actions
10597

@@ -141,10 +133,3 @@ See below for a summary of this repo's Actions
141133
- Scheduled to run at 3am each day.
142134
- Actions
143135
- Deletes any Workers and Pages projects that were not properly cleaned up by the C3 E2E tests.
144-
145-
### Prerelease create-cloudflare (prerelease-create-cloudflare.yml)
146-
147-
- Triggers
148-
- Commits merged to the `main` branch, on the Cloudflare fork.
149-
- Actions
150-
- Publishes the `create-cloudflare` package to npm under the `beta` dist-tag.

.github/workflows/changesets.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,20 @@ jobs:
3939
- name: Check the changesets
4040
run: node -r esbuild-register tools/deployments/validate-changesets.ts
4141

42-
- name: Check the build
43-
run: pnpm run build
44-
env:
45-
CI_OS: ${{ runner.os }}
42+
- name: "Configure turbo repo cache environment variables"
43+
run: |
44+
touch .env
45+
echo TURBO_API=${{ secrets.TURBO_API }} >> .env
46+
echo TURBO_TEAM=${{ secrets.TURBO_TEAM }} >> .env
47+
echo TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} >> .env
48+
echo TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} >> .env
4649
4750
- name: Create Version PR or Publish to NPM
4851
id: changesets
4952
uses: changesets/action@v1
5053
with:
5154
version: node .github/changeset-version.js
55+
# This runs wrangler#prepublishOnly, which runs a turbo build at the root of the repo
5256
publish: pnpm exec changeset publish
5357
env:
5458
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

.github/workflows/deploy-pages-previews.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# Only run this on PRs that are for the "cloudflare" org and not "from" `main`
2626
# - non-Cloudflare PRs will not have the secrets needed
2727
# - PRs "from" main would accidentally do a production deployment
28-
if: github.repository_owner == 'cloudflare' && github.head_ref != 'main'
28+
if: github.repository_owner == 'cloudflare' && github.head_ref != 'main' && (contains(github.event.*.labels.*.name, 'preview:wrangler-devtools') || contains(github.event.*.labels.*.name, 'preview:quick-edit') || contains(github.event.*.labels.*.name, 'preview:workers-playground'))
2929
timeout-minutes: 60
3030
concurrency:
3131
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/e2e.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ jobs:
3939
- name: Install NPM Dependencies
4040
run: pnpm install --frozen-lockfile
4141

42+
- name: "Configure turbo repo cache environment variables"
43+
run: |
44+
touch .env
45+
echo TURBO_API=${{ secrets.TURBO_API }} >> .env
46+
echo TURBO_TEAM=${{ secrets.TURBO_TEAM }} >> .env
47+
echo TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} >> .env
48+
echo TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} >> .env
49+
4250
- name: Run builds
4351
run: pnpm run build
4452
env:
@@ -53,14 +61,15 @@ jobs:
5361
NODE_ENV: "production"
5462

5563
- name: Run tests
56-
run: pnpm run --filter wrangler test:e2e
64+
run: pnpm run test:e2e
5765
env:
5866
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
5967
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
6068
WRANGLER: node ${{ github.workspace}}/temp/wrangler/bin/wrangler.js
6169
WRANGLER_IMPORT: ${{ github.workspace}}/temp/wrangler/wrangler-dist/cli.js
6270
NODE_OPTIONS: "--max_old_space_size=8192"
6371
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
72+
CI_OS: ${{ matrix.os }}
6473

6574
- name: Upload debug logs
6675
if: always()

.github/workflows/prerelease-create-cloudflare.yml

-46
This file was deleted.

.github/workflows/prereleases.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Prerelease
1+
name: Publish @beta pre-release
22

33
on:
44
push:
@@ -53,7 +53,7 @@ jobs:
5353
env:
5454
NODE_OPTIONS: "--max_old_space_size=8192"
5555

56-
- name: Publish Beta to NPM
56+
- name: Publish wrangler@beta to NPM
5757
run: pnpm publish --tag beta
5858
env:
5959
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
@@ -64,6 +64,12 @@ jobs:
6464
ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }}
6565
working-directory: packages/wrangler
6666

67+
- name: Publish create-cloudflare@beta to NPM
68+
run: pnpm publish --tag beta
69+
env:
70+
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
71+
working-directory: packages/create-cloudflare
72+
6773
- name: Get Package Version
6874
run: echo "WRANGLER_VERSION=$(npm view wrangler@beta version)" >> $GITHUB_ENV
6975
working-directory: packages/wrangler

.github/workflows/pullrequests.yml .github/workflows/test-and-check.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Pull Request
1+
name: Tests + Checks
22

33
on: pull_request
44

55
env:
66
node-version: 16.18
77
jobs:
88
add-to-project:
9+
if: github.ref != 'refs/heads/changeset-release/main'
910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.ref }}-add-pr
1112
cancel-in-progress: true
@@ -42,7 +43,7 @@ jobs:
4243
node-version: ${{ env.node-version }}
4344
cache: "pnpm"
4445

45-
- name: "Create .env file"
46+
- name: "Configure turbo repo cache environment variables"
4647
run: |
4748
touch .env
4849
echo TURBO_API=${{ secrets.TURBO_API }} >> .env
@@ -91,7 +92,7 @@ jobs:
9192
node-version: ${{ env.node-version }}
9293
cache: "pnpm"
9394

94-
- name: "Create .env file"
95+
- name: "Configure turbo repo cache environment variables"
9596
run: |
9697
touch .env
9798
echo TURBO_API=${{ secrets.TURBO_API }} >> .env
@@ -102,19 +103,14 @@ jobs:
102103
- name: Install NPM Dependencies
103104
run: pnpm install --frozen-lockfile
104105

105-
- name: Run builds
106-
run: pnpm run build
107-
env:
108-
NODE_ENV: "production"
109-
CI_OS: ${{ runner.os }}
110-
111106
- name: Run tests
112107
run: pnpm run test:ci
113108
env:
114109
TMP_CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
115110
TMP_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
116111
NODE_OPTIONS: "--max_old_space_size=8192"
117112
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
113+
CI_OS: ${{ runner.os }}
118114

119115
- name: Upload debug logs
120116
if: always()

.github/workflows/test-old-node-error.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Test old Node.js version
22

3-
on: pull_request
3+
on:
4+
push:
5+
branches:
6+
- changeset-release/main
47

58
jobs:
69
check:

fixtures/shared/src/run-wrangler-long-lived.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async function runLongLivedWrangler(
9494
separator,
9595
].join("\n");
9696
rejectReadyPromise(new Error(message));
97-
}, 20_000);
97+
}, 50_000);
9898

9999
async function stop() {
100100
const closePromise = events.once(wranglerProcess, "close");

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"prettify": "prettier . --write --ignore-unknown",
2222
"test": "vitest run --no-file-parallelism && dotenv -- turbo test --filter=wrangler --filter=miniflare --filter=kv-asset-handler --filter=@cloudflare/vitest-pool-workers --filter=@cloudflare/vitest-pool-workers-examples",
2323
"test:ci": "dotenv -- turbo test:ci",
24+
"test:e2e": "dotenv -- turbo test:e2e --filter=wrangler",
2425
"test:watch": "turbo test:watch",
2526
"type:tests": "dotenv -- turbo type:tests",
2627
"gen:package": "turbo gen package"
@@ -30,7 +31,6 @@
3031
"@types/node": "^20.0.0",
3132
"cross-env": "^7.0.3",
3233
"esbuild-register": "^3.5.0",
33-
"ioredis": "^4.28.2",
3434
"jsonc-parser": "^3.2.0",
3535
"prettier": "^2.6.2",
3636
"prettier-plugin-packagejson": "^2.2.18",

packages/create-cloudflare/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"check:lint": "eslint .",
3232
"check:type": "tsc",
3333
"lint": "eslint",
34-
"prepublishOnly": "pnpm run build",
34+
"prepublishOnly": "pnpm -w run build",
3535
"test:e2e:cleanup": "node -r esbuild-register scripts/e2eCleanup.ts",
3636
"test:e2e:npm": "pnpm run build && cross-env TEST_PM=npm vitest run --config ./vitest-e2e.config.ts",
3737
"test:e2e:pnpm": "pnpm run build && cross-env TEST_PM=pnpm vitest run --config ./vitest-e2e.config.ts",

packages/wrangler/package.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
6161
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
6262
"generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json",
63-
"prepublishOnly": "SOURCEMAPS=false pnpm run build",
63+
"prepublishOnly": "SOURCEMAPS=false pnpm run -w build",
6464
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
6565
"test": "pnpm run assert-git-version && jest",
6666
"test:ci": "pnpm run test",
@@ -113,7 +113,6 @@
113113
"xxhash-wasm": "^1.0.1"
114114
},
115115
"devDependencies": {
116-
"@cloudflare/ai": "^1.0.35",
117116
"@cloudflare/cli": "workspace:*",
118117
"@cloudflare/eslint-config-worker": "*",
119118
"@cloudflare/pages-shared": "workspace:^",
@@ -127,7 +126,6 @@
127126
"@sentry/types": "^7.86.0",
128127
"@sentry/utils": "^7.86.0",
129128
"@types/body-parser": "^1.19.2",
130-
"@types/busboy": "^1.5.0",
131129
"@types/command-exists": "^1.2.0",
132130
"@types/express": "^4.17.13",
133131
"@types/glob-to-regexp": "0.4.1",
@@ -142,7 +140,6 @@
142140
"@types/serve-static": "^1.13.10",
143141
"@types/shell-quote": "^1.7.2",
144142
"@types/signal-exit": "^3.0.1",
145-
"@types/source-map-support": "^0.5.7",
146143
"@types/supports-color": "^8.1.1",
147144
"@types/ws": "^8.5.3",
148145
"@types/yargs": "^17.0.10",
@@ -160,7 +157,6 @@
160157
"esbuild-jest": "0.5.0",
161158
"execa": "^6.1.0",
162159
"express": "^4.18.1",
163-
"finalhandler": "^1.2.0",
164160
"find-up": "^6.3.0",
165161
"get-port": "^6.1.2",
166162
"glob-to-regexp": "0.4.1",
@@ -171,8 +167,6 @@
171167
"ink-select-input": "^4.2.1",
172168
"ink-spinner": "^4.0.3",
173169
"ink-table": "^3.0.0",
174-
"ink-testing-library": "^2.1.0",
175-
"ink-text-input": "^4.0.3",
176170
"is-ci": "^3.0.1",
177171
"javascript-time-ago": "^2.5.4",
178172
"jest": "^29.7.0",
@@ -188,7 +182,6 @@
188182
"prompts": "^2.4.2",
189183
"react": "^17.0.2",
190184
"react-error-boundary": "^3.1.4",
191-
"remove-accents-esm": "^0.0.1",
192185
"semiver": "^1.1.0",
193186
"serve-static": "^1.15.0",
194187
"shell-quote": "^1.8.1",

0 commit comments

Comments
 (0)