-
Notifications
You must be signed in to change notification settings - Fork 615
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
Granular e2e caching #6201
Granular e2e caching #6201
Conversation
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-wrangler-6201 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6201/npm-package-wrangler-6201 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-wrangler-6201 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-create-cloudflare-6201 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-cloudflare-kv-asset-handler-6201 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-miniflare-6201 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-cloudflare-pages-shared-6201 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9809434507/npm-package-cloudflare-vitest-pool-workers-6201 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
b14e4f3
to
51d01a7
Compare
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.
Unfortunately this breaks on Windows due to its inability to have :
colons in filepaths.
Is it not possible to make this more dynamic by using an ENV var to set which e2e tests to run and then running turbo multiple times for each env var?
* As such, we run the `test:e2e` turbo task multiple times—once per e2e test file | ||
* with different arguments, ensuring that each file's tests can be cached individually. |
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.
🎉
// Ignore other files in the e2e directory (the README, for instance) | ||
if (file.endsWith(".test.ts")) { | ||
tasks.add( | ||
`pnpm test:e2e --log-order=stream --summarize --filter wrangler --concurrency 1 -- run ./e2e/${file}` |
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.
Perhaps we could run the build
task once at at the start of the run, and then use the --only
flag here to avoid dumping all the build output out each time (even though it is full turbo)?
What this PR solves / how to test
Turbo only supports caching on the individual task level, but for Wrangler's e2e tests we want to support caching on a more granular basis—at the file level.
As such, this PR constructs multiple turbo tasks—one per e2e test file, ensuring that each file's tests can be cached individually.
Because Turbo ignores the cache when
package.json
changes, we can't generate thesepackage.json
scripts on the fly in CI, and so we require them to be commited to the repository. Since this is easy to mess up, this PR adds a script to lintturbo.json
, the rootpackage.json
, and Wrangler'spackage.json
to ensure everything is set up as intended.The intended flow here is that CI will run
pnpm test:e2e:wrangler
, which will trigger turbo to run an individual task for each Wrangler e2e test file. These tasks are defined in the rootturbo.json
, and correspond to scripts in the Wrangler package. We ensure there's no accidental task name collision across packages by adding--filter wrangler
to the turbo command, to make it only run tasks in the Wrangler package.An example of the benefit this gives us are these two runs:
This e2e test run failed in
dev-with-resources.test.ts
, but passed `dev-env.test.tsOn a re-run, the previous
dev-env.test.ts
success was cached, speeding up the test runAuthor has addressed the following