From df2b9600255be3cae24cf0f0336e27da517da2b7 Mon Sep 17 00:00:00 2001 From: Samuel Macleod Date: Wed, 18 Dec 2024 14:15:58 +0000 Subject: [PATCH] run C3 E2E against Wrangler pre-release --- .github/actions/run-c3-e2e/action.yml | 1 + .../create-pullrequest-prerelease.yml | 59 ++++++++++++++++++- .../create-cloudflare/src/helpers/packages.ts | 2 +- packages/create-cloudflare/turbo.json | 6 +- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/actions/run-c3-e2e/action.yml b/.github/actions/run-c3-e2e/action.yml index c7e3cca8b32a..799e25de4abf 100644 --- a/.github/actions/run-c3-e2e/action.yml +++ b/.github/actions/run-c3-e2e/action.yml @@ -52,6 +52,7 @@ runs: TEST_PM: ${{ inputs.packageManager }} TEST_PM_VERSION: ${{ inputs.packageManagerVersion }} CI_OS: ${{ runner.os }} + WRANGLER_PACKAGE: https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/${{ github.event.number }}/npm-package-wrangler-${{ github.event.number }} - name: Upload Logs uses: actions/upload-artifact@v4 diff --git a/.github/workflows/create-pullrequest-prerelease.yml b/.github/workflows/create-pullrequest-prerelease.yml index 9d6d378bf7e6..172fea319713 100644 --- a/.github/workflows/create-pullrequest-prerelease.yml +++ b/.github/workflows/create-pullrequest-prerelease.yml @@ -1,4 +1,4 @@ -name: Create Pull Request Prerelease +name: PR Pre-releases & C3 E2E on: pull_request @@ -73,3 +73,60 @@ jobs: # Required by the `@actions/artifact` package ACTIONS_RUNTIME_TOKEN: ${{ env.GITHUB_ACTIONS_RUNTIME_TOKEN }} ACTIONS_RESULTS_URL: ${{ env.GITHUB_ACTIONS_RESULTS_URL }} + + c3-e2e: + needs: build + # Note: please keep this job in sync with the e2e-only-dependabot-bumped-framework one + #  in .github/workflows/c3-e2e-dependabot.yml + timeout-minutes: 45 + concurrency: + 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) }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + pm: + [ + { name: npm, version: "0.0.0" }, + { name: pnpm, version: "9.12.0" }, + { name: bun, version: "1.0.3" }, + { name: yarn, version: "1.0.0" }, + ] + # include a single windows test with pnpm + include: + - os: windows-latest + pm: { name: pnpm, version: "9.12.0" } + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + everything_but_markdown: + - '!**/*.md' + + - name: Install Dependencies + if: steps.changes.outputs.everything_but_markdown == 'true' + uses: ./.github/actions/install-dependencies + with: + turbo-api: ${{ secrets.TURBO_API }} + turbo-team: ${{ secrets.TURBO_TEAM }} + turbo-token: ${{ secrets.TURBO_TOKEN }} + turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} + + - name: E2E Tests + if: steps.changes.outputs.everything_but_markdown == 'true' + uses: ./.github/actions/run-c3-e2e + with: + packageManager: ${{ matrix.pm.name }} + packageManagerVersion: ${{ matrix.pm.version }} + quarantine: false + accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} + apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} diff --git a/packages/create-cloudflare/src/helpers/packages.ts b/packages/create-cloudflare/src/helpers/packages.ts index 7771267bf686..e966f2ee900b 100644 --- a/packages/create-cloudflare/src/helpers/packages.ts +++ b/packages/create-cloudflare/src/helpers/packages.ts @@ -94,7 +94,7 @@ export const installWrangler = async () => { return; } - await installPackages([`wrangler`], { + await installPackages([process.env.WRANGLER_PACKAGE ?? `wrangler`], { dev: true, startText: `Installing wrangler ${dim( "A command line tool for building Cloudflare Workers", diff --git a/packages/create-cloudflare/turbo.json b/packages/create-cloudflare/turbo.json index 4788d8353d22..fff35170aa48 100644 --- a/packages/create-cloudflare/turbo.json +++ b/packages/create-cloudflare/turbo.json @@ -10,7 +10,8 @@ "CI", "CREATE_CLOUDFLARE_TELEMETRY_DISABLED", "CREATE_CLOUDFLARE_TELEMETRY_DEBUG", - "SPARROW_SOURCE_KEY" + "SPARROW_SOURCE_KEY", + "WRANGLER_PACKAGE" ], "outputs": ["dist/**"] }, @@ -24,7 +25,8 @@ "E2E_RETRIES", "E2E_NO_DEPLOY", "E2E_EXPERIMENTAL", - "TEST_PM" + "TEST_PM", + "WRANGLER_PACKAGE" ], "dependsOn": ["build"], "outputs": [".e2e-logs", ".e2e-logs-experimental"]