Skip to content

Conversation

@penalosa
Copy link
Contributor

@penalosa penalosa commented Jun 25, 2025

One of the most painful category of release issues is Something is wrong in VP that could have been caught earlier. e.g.

  • A PR was merged that didn’t run E2E tests but that broke them
  • A PR was merged which combined badly with something else already on main

This PR aims to address that pain by running all tests (including E2E tests) in the Merge Queue, which we already enforce as a merge strategy. That will mean that forks can run E2E tests (since at the point a fork PR is in the Merge Queue it’s been approved, so can be trusted to run E2E tests with tokens). It will also mean that nothing lands in main without fully passing E2E tests, having been rebased on top of the tip of main. This also means we no longer have a split between PRs and VP in terms of what OS tests are run on.

There are a couple of things this PR has done to make this work well:

  • Some hacking around of GH Actions to get things properly marked as required even if they’re skipped (basically, how can we make E2E tests a required check without completely breaking forks?). To do this, I've changed the stage at which runs that will be skipped are skipped—in exactly the same way as we do for markdown-only PRs, where CI tests don’t properly “run” but they do “run” from the perspective of GH Actions.
  • Apply pending changeset version bumps to packages before running tests. Every so often we get test failures on VP that didn’t show up on PRs because VP has bumped the version numbers in package.json files according to the pending changesets publish. This PR also applies this pending version update to the package.json files in packages before running tests on all workflows. This also has the benefit of allowing test runs on VP to hit cached values.

This PR also simplifies the pull request template by:

  • Removing the TODO checkboxes
  • Removing the E2E checkboxes (since now they always run)
  • Changing the tests checkbox to only have the option to mark "Tests included". This can be bypassed with the no-tests label, but hopefully removing the visible option for not including tests will encourage people to include tests

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: not a Wrangler change

@penalosa penalosa requested a review from a team as a code owner June 25, 2025 01:19
@changeset-bot
Copy link

changeset-bot bot commented Jun 25, 2025

⚠️ No Changeset found

Latest commit: 8d729e1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 25, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9737

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9737

miniflare

npm i https://pkg.pr.new/miniflare@9737

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9737

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9737

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9737

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9737

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9737

wrangler

npm i https://pkg.pr.new/wrangler@9737

commit: 8d729e1

@penalosa penalosa added the skip-pr-description-validation Skip validation of the required PR description format label Jun 25, 2025
},
"optionalDependencies": {
"@cdktf/node-pty-prebuilt-multiarch": "0.10.1-pre.11"
"@cdktf/node-pty-prebuilt-multiarch": "0.10.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a version bump while trying to get this fixture working in later versions of Node. Turns out it doesn't support them though (see cdktf/node-pty-prebuilt-multiarch#119), but there's no harm in using a slightly newer version

- name: Check for errors
run: pnpm run check --summarize
- name: Bump package versions
run: node .github/changeset-version.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there anything to worry about here re: order of merges? is this on every workflow just in case, or could they conflict somehow? i guess i don't really understand why different versions has caused failures in VP/what sort of failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't affect the actual code that is merged from a PR, it just ensures that the tests run against the PR as if it was on VP (with the version bumps applied). This is both to prevent problems (e.g. C3 inadvertently works because the published version of Wrangler is the same as the version on disk, but fails for some reason if they're different, which has happened in the past), but also to fix turbo caches so that VP can be cached. Currently VP is completely uncached because all the package.json files change, which busts the cache

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@penalosa penalosa requested a review from emily-shen June 25, 2025 14:47
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jun 25, 2025
- Tests
- [ ] TODO (before merge)
- [ ] Tests included
- [ ] Tests not necessary because:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to remove this checkbox? this change doesn't seem intentional to me? 🤔

(test being the only checkbox without the not-necessary checkbox)
Screenshot 2025-06-25 at 17 12 50

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Samuel mentioned in the description that Changing the tests checkbox to only have the option to mark "Tests included". This can be bypassed with the no-tests label.

But I wonder if it's better to keep the no test checkbox as we lost the context on why if we rely on the label.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... yeah but the way I would expect it, similarly to how V3 backporting works, is that we do have the check and also the label 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description had my motivation here: "hopefully removing the visible option for not including tests will encourage people to include tests", but happy to revert this. My thinking was that basically all PRs should have tests, and it should be fairly hidden option to not add tests. It'll also be much more obvious for us when reviewing that a PR has the no-tests label, which should make it easier to spot if something has been inadvertently marked as not requiring tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted this change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll also be much more obvious for us when reviewing that a PR has the no-tests label, which should make it easier to spot if something has been inadvertently marked as not requiring tests.

External contributors can't add the label though 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that basically all PRs should have tests

I agree if we're talking about actual code changes, but often there other types of changes that don't require tests, such as code comments, changeset changes, templates changes, infra changes, md changes (which we do have a comment about in the pr template anyways) 🤔

on:
merge_group:
pull_request:
types: [synchronize, opened, reopened, labeled, unlabeled]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're not checking for labels anymore shouldn't we remove labeled/unlabeled from here? (we don't need to re-run the workflow when labels change, right?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this also applies to the other workflows)

group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.pm.name }}-${{ matrix.pm.version }}
cancel-in-progress: true
name: ${{ format('Run tests for {0}@{1} on {2}', matrix.pm.name, matrix.pm.version, matrix.os) }}
name: ${{ format('C3 ({0})', matrix.label) }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really avoid using the word label used for something different from what GitHub refers as labels, sounds to me like something bound to cause confusion at some point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this also applies to the other workflows)

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a few comments, but nothing blocking, looks good to me 🙂

Comment on lines 9 to 73
name: ${{ format('Wrangler ({0})', matrix.description) }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}-wrangler
cancel-in-progress: true
timeout-minutes: 60
if: github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare' && (github.head_ref == 'changeset-release/main' || contains(github.event.*.labels.*.name, 'every-os' ))
strategy:
fail-fast: false
matrix:
os: [macos-13, windows-2022]
node: ["20.19.1"]
include:
- os: macos-13
description: v20, macOS
node: 20.19.1
- os: windows-2022
description: v20, Windows
node: 20.19.1
- os: ubuntu-22.04-arm
description: v20, Linux
node: 20.19.1

runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
if: github.event.pull_request.head.repo.owner.login == 'cloudflare'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Dependencies
if: github.event.pull_request.head.repo.owner.login == 'cloudflare'
uses: ./.github/actions/install-dependencies
with:
node-version: ${{ matrix.node }}
turbo-api: ${{ secrets.TURBO_API }}
turbo-team: ${{ secrets.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}

- name: Run Vite E2E tests
run: pnpm test:e2e -F @cloudflare/vite-plugin --log-order=stream
timeout-minutes: 15
- name: Bump package versions
run: node .github/changeset-version.js
env:
NODE_DEBUG: "vite-plugin:test"
# The AI tests need to connect to Cloudflare
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
NODE_OPTIONS: "--max_old_space_size=8192"
CI_OS: ${{ matrix.os }}
GITHUB_TOKEN: ${{ github.token }}

- name: Run Wrangler E2E tests
if: github.event.pull_request.head.repo.owner.login == 'cloudflare'
run: pnpm run test:e2e:wrangler
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
HYPERDRIVE_DATABASE_URL: ${{ secrets.TEST_HYPERDRIVE_DATABASE_URL}}
WRANGLER: node --no-warnings ${{ github.workspace}}/packages/wrangler/bin/wrangler.js
WRANGLER_IMPORT: ${{ github.workspace}}/packages/wrangler/wrangler-dist/cli.js
MINIFLARE_IMPORT: ${{ github.workspace}}/packages/miniflare/dist/src/index.js
NODE_OPTIONS: "--max_old_space_size=8192"
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html
CI_OS: ${{ matrix.os }}

- name: Upload turbo logs
if: always()
uses: actions/upload-artifact@v4
with:
name: turbo-runs-${{ matrix.os }}-${{ matrix.node }}
path: .turbo/runs

e2e-test:
name: "E2E tests"
e2e-vite-test:
name: ${{ format('Vite ({0})', matrix.description) }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}-vite
cancel-in-progress: true
timeout-minutes: 60
if: github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04-arm]
node: ["20.19.1"]
include:
- os: macos-13

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 7 months ago

To fix the issue, we will add a permissions block at the root of the workflow file. This block will define the minimal permissions required for the workflow to function correctly. Based on the workflow's operations, the following permissions are necessary:

  • contents: read for accessing repository contents.
  • contents: write for the "Bump package versions" step, which modifies repository files.

The permissions block will be added at the root level to apply to all jobs in the workflow. If any job requires additional permissions, they can be overridden within the specific job.


Suggested changeset 1
.github/workflows/e2e.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -2,2 +2,5 @@
 
+permissions:
+  contents: write
+
 on:
EOF
@@ -2,2 +2,5 @@

permissions:
contents: write

on:
Copilot is powered by AI and may make mistakes. Always verify output.
@penalosa penalosa enabled auto-merge June 26, 2025 10:36
@penalosa penalosa added this pull request to the merge queue Jun 26, 2025
Merged via the queue into main with commit 6fb8f50 Jun 26, 2025
29 checks passed
@penalosa penalosa deleted the penalosa/more-tests branch June 26, 2025 10:43
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-description-validation Skip validation of the required PR description format

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants