diff --git a/.github/actions/create-c3-docs-pr/action.yml b/.github/actions/create-c3-docs-pr/action.yml deleted file mode 100644 index 91e431137b5a..000000000000 --- a/.github/actions/create-c3-docs-pr/action.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: "Create C3 Docs PR" -description: "Creates a PR to Cloudflare Docs most recent C3 diffs for full-stack frameworks" -inputs: - token: - description: "Github access token" - required: true - releaseBranch: - description: "Name of the release branch containing diff workflow run" - required: true - targetHeadBranch: - description: "The name of the branch to push to in the target repo" - required: true - targetBaseBranch: - description: "The name of the base (main) branch to PR against in the target repo" - required: true -runs: - using: "composite" - steps: - - name: Lookup Workflow ID - id: lookup-workflow-id - uses: actions/github-script@v7 - with: - retries: 3 - retry-exempt-status-codes: 400,401,403 - github-token: ${{ inputs.token }} - script: | - const {data: workflows} = await github.rest.actions.listWorkflowRuns({ - owner: "cloudflare", - repo: "workers-sdk", - branch: "${{ inputs.releaseBranch }}", - workflow_id: "c3-e2e.yml", - per_page: 1, - }); - return workflows.workflow_runs[0].id; - - # For debug purposes - - name: Echo Workflow Id - shell: bash - run: | - echo ${{ steps.lookup-workflow-id.outputs.result }} - - - name: Configure Git - shell: bash - run: | - git config --global user.email wrangler@cloudflare.com - git config --global user.name 'Wrangler automated PR updater' - - - name: Checkout Destination Repo - uses: actions/checkout@v4 - with: - repository: cloudflare/cloudflare-docs - path: ./clone-dir - ref: ${{ inputs.targetBaseBranch }} - token: ${{ inputs.token }} - fetch-depth: 0 - - - name: Create Branch - working-directory: ./clone-dir - shell: bash - run: | - git checkout -b "c3-diffs-${{ github.sha }}" - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: e2e-framework-diffs - path: ./clone-dir/content/pages/_partials/framework-diffs/ - github-token: ${{ inputs.token }} - run-id: ${{ steps.lookup-workflow-id.outputs.result }} - - - name: Git Commit - id: git-commit - working-directory: ./clone-dir - shell: bash - run: | - git add diffs - if git status | grep -q "Changes to be committed" - then - git commit -m "Updating diffs" - git push -f -u origin HEAD:${{ inputs.targetHeadBranch }} - echo "has_changes=true" >> $GITHUB_OUTPUT - else - echo "No changes detected, skipping PR creation." - echo "has_changes=false" >> $GITHUB_OUTPUT - fi - - - name: Create PR - working-directory: ./clone-dir - if: ${{ steps.git-commit.outputs.has_changes == 'true' }} - shell: bash - env: - GH_TOKEN: ${{ inputs.token }} - run: | - gh pr create \ - -t "Updating C3 framework diffs" \ - -b "Adding C3 diffs from workers-sdk release https://github.com/${{ github.repository }}/commit/${{ github.sha }}" \ - -B ${{ inputs.targetBaseBranch }} \ - -H ${{ inputs.targetHeadBranch }} diff --git a/.github/actions/run-c3-e2e/action.yml b/.github/actions/run-c3-e2e/action.yml index fa421e0c18d9..c17cf79f86ca 100644 --- a/.github/actions/run-c3-e2e/action.yml +++ b/.github/actions/run-c3-e2e/action.yml @@ -22,9 +22,6 @@ inputs: apiToken: description: "The api token of the test account" required: true - saveDiffs: - description: "Whether to retain diffs of framework templates during run" - required: true runs: using: "composite" @@ -54,7 +51,6 @@ runs: FRAMEWORK_CLI_TO_TEST: ${{ inputs.framework }} TEST_PM: ${{ inputs.packageManager }} TEST_PM_VERSION: ${{ inputs.packageManagerVersion }} - SAVE_DIFFS: ${{ inputs.saveDiffs }} CI_OS: ${{ runner.os }} - name: Upload Logs @@ -64,14 +60,6 @@ runs: name: e2e-logs${{inputs.experimental && '-experimental' || ''}}-${{matrix.os}} path: packages/create-cloudflare/.e2e-logs${{inputs.experimental && '-experimental' || ''}} - - name: Upload Framework Diffs - if: ${{ steps.run-e2e.outcome == 'success' && inputs.saveDiffs == 'true' }} - uses: actions/upload-artifact@v3 - with: - name: e2e-framework-diffs${{inputs.experimental && '-experimental' || ''}} - path: packages/create-cloudflare/.e2e-diffs${{inputs.experimental && '-experimental' || ''}} - overwrite: true - - name: Fail if errors detected shell: bash if: ${{ steps.run-e2e.outcome == 'failure' }} diff --git a/.github/workflows/c3-e2e-dependabot.yml b/.github/workflows/c3-e2e-dependabot.yml index 1dc1d34c7a09..eb093457bfc7 100644 --- a/.github/workflows/c3-e2e-dependabot.yml +++ b/.github/workflows/c3-e2e-dependabot.yml @@ -78,4 +78,3 @@ jobs: framework: ${{ needs.get-dependabot-bumped-framework.outputs.bumped-framework-cli }} accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} - saveDiffs: false diff --git a/.github/workflows/c3-e2e-experimental.yml b/.github/workflows/c3-e2e-experimental.yml index 9e18e2faa4c7..800cd82c919e 100644 --- a/.github/workflows/c3-e2e-experimental.yml +++ b/.github/workflows/c3-e2e-experimental.yml @@ -64,5 +64,3 @@ jobs: experimental: true accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} - # We only need to do this once per-framework per-run, so avoid re-running for each package manager and os - saveDiffs: ${{ github.head_ref == 'changeset-release/main' && matrix.pm.name == 'pnpm' && matrix.os == 'ubuntu-latest'}} diff --git a/.github/workflows/c3-e2e-quarantine.yml b/.github/workflows/c3-e2e-quarantine.yml index b30c7f700cc4..bf861e04c516 100644 --- a/.github/workflows/c3-e2e-quarantine.yml +++ b/.github/workflows/c3-e2e-quarantine.yml @@ -48,4 +48,3 @@ jobs: quarantine: true accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} - saveDiffs: false diff --git a/.github/workflows/c3-e2e.yml b/.github/workflows/c3-e2e.yml index 3ed7b444f86a..3c3ef3c3fa71 100644 --- a/.github/workflows/c3-e2e.yml +++ b/.github/workflows/c3-e2e.yml @@ -63,5 +63,3 @@ jobs: quarantine: false accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} - # We only need to do this once per-framework per-run, so avoid re-running for each package manager and os - saveDiffs: ${{ github.head_ref == 'changeset-release/main' && matrix.pm.name == 'pnpm' && matrix.os == 'ubuntu-latest'}} diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index 15433e7f384f..4c5b967836a9 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -60,12 +60,3 @@ jobs: WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID }} WORKERS_NEW_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_NEW_CLOUDFLARE_API_TOKEN }} WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN }} - - - name: Create C3 Diffs PR - if: contains(steps.changesets.outputs.publishedPackages, '"create-cloudflare"') - uses: ./.github/actions/create-c3-docs-pr - with: - token: ${{ secrets.C3_DIFF_TOOL_GH_TOKEN }} - releaseBranch: "changeset-release/main" - targetHeadBranch: c3-diffs-${{ github.sha }} - targetBaseBranch: production diff --git a/packages/create-cloudflare/.env.example b/packages/create-cloudflare/.env.example index 2e5478ed5cbd..bf33e8568a55 100644 --- a/packages/create-cloudflare/.env.example +++ b/packages/create-cloudflare/.env.example @@ -7,5 +7,4 @@ # E2E_PROJECT_PATH=? # the path were to build the projects (for easier debugging, instead of having to find the tmpdir) # E2E_RETRIES=0 # the number of retries for framework e2e tests # E2E_NO_DEPLOY=true # flag to skip the deployment step in the e2es (for easier debugging, where the deployment is not relevant to current changes) -# SAVE_DIFFS=true # flag to trigger the diffs saving during the e2es process # E2E_EXPERIMENTAL=true # flag to run only experimental framework e2e tests diff --git a/packages/create-cloudflare/.gitignore b/packages/create-cloudflare/.gitignore index ae10202c35a5..db7dbd67a7c7 100644 --- a/packages/create-cloudflare/.gitignore +++ b/packages/create-cloudflare/.gitignore @@ -2,7 +2,6 @@ node_modules /dist create-cloudflare-*.tgz /.e2e-logs*/* -/.e2e-diffs*/* .DS_Store diff --git a/packages/create-cloudflare/e2e-tests/frameworks.test.ts b/packages/create-cloudflare/e2e-tests/frameworks.test.ts index b5fdc9d2b2cc..19649959c869 100644 --- a/packages/create-cloudflare/e2e-tests/frameworks.test.ts +++ b/packages/create-cloudflare/e2e-tests/frameworks.test.ts @@ -1,8 +1,7 @@ import { existsSync } from "fs"; import { cp } from "fs/promises"; import { join } from "path"; -import { runCommand } from "helpers/command"; -import { readFile, readToml, writeFile, writeToml } from "helpers/files"; +import { readFile, readToml, writeToml } from "helpers/files"; import { detectPackageManager } from "helpers/packageManagers"; import { retry } from "helpers/retry"; import { sleep } from "helpers/sleep"; @@ -12,11 +11,9 @@ import { deleteProject, deleteWorker } from "../scripts/common"; import { getFrameworkMap } from "../src/templates"; import { getFrameworkToTest } from "./frameworkToTest"; import { - getDiffsPath, isQuarantineMode, keys, kill, - recreateDiffsFolder, recreateLogFolder, runC3, spawnWithLogging, @@ -417,7 +414,6 @@ describe.concurrent( () => { beforeAll(async (ctx) => { recreateLogFolder({ experimental }, ctx); - recreateDiffsFolder({ experimental }); }); Object.keys(frameworkTests).forEach((frameworkId) => { @@ -486,7 +482,6 @@ describe.concurrent( ); await verifyBuildCfTypesScript(testConfig, project.path, logStream); await verifyBuildScript(testConfig, project.path, logStream); - await storeDiff(frameworkId, project.path, { experimental }); } catch (e) { console.error("ERROR", e); expect.fail( @@ -510,25 +505,6 @@ describe.concurrent( }, ); -const storeDiff = async ( - framework: string, - projectPath: string, - opts: { experimental: boolean }, -) => { - if (!process.env.SAVE_DIFFS) { - return; - } - - const outputPath = join(getDiffsPath(opts), `${framework}.diff`); - - const output = await runCommand(["git", "diff"], { - silent: true, - cwd: projectPath, - }); - - writeFile(outputPath, output); -}; - const runCli = async ( framework: string, projectPath: string, @@ -546,7 +522,7 @@ const runCli = async ( framework, NO_DEPLOY ? "--no-deploy" : "--deploy", "--no-open", - process.env.SAVE_DIFFS ? "--git" : "--no-git", + "--no-git", ]; args.push(...argv); diff --git a/packages/create-cloudflare/e2e-tests/helpers.ts b/packages/create-cloudflare/e2e-tests/helpers.ts index 479bbb619764..491169eccf5c 100644 --- a/packages/create-cloudflare/e2e-tests/helpers.ts +++ b/packages/create-cloudflare/e2e-tests/helpers.ts @@ -304,22 +304,6 @@ export const createTestLogStream = ( }); }; -export const recreateDiffsFolder = (opts: { experimental: boolean }) => { - // Recreate the diffs folder - const diffsPath = getDiffsPath(opts); - rmSync(diffsPath, { - recursive: true, - force: true, - }); - mkdirSync(diffsPath, { recursive: true }); -}; - -export const getDiffsPath = (opts: { experimental: boolean }) => { - return path.resolve( - "./.e2e-diffs" + (opts.experimental ? "-experimental" : ""), - ); -}; - export const recreateLogFolder = ( opts: { experimental: boolean }, suite: Suite, diff --git a/packages/create-cloudflare/src/frameworks/index.ts b/packages/create-cloudflare/src/frameworks/index.ts index 121978a0b9f3..5ba831072e34 100644 --- a/packages/create-cloudflare/src/frameworks/index.ts +++ b/packages/create-cloudflare/src/frameworks/index.ts @@ -2,7 +2,6 @@ import { logRaw, updateStatus } from "@cloudflare/cli"; import { dim } from "@cloudflare/cli/colors"; import { quoteShellArgs, runCommand } from "helpers/command"; import { detectPackageManager } from "helpers/packageManagers"; -import { isInsideGitRepo } from "../git"; import frameworksPackageJson from "./package.json"; import type { C3Context } from "types"; @@ -47,23 +46,4 @@ export const runFrameworkGenerator = async (ctx: C3Context, args: string[]) => { logRaw(""); await runCommand(cmd, { env }); - - // When running e2e tests, commit the result of the scaffolding tool to facilitate - // diffing what new code is added by C3 as part of the process - if (process.env.SAVE_DIFFS) { - const cmdEnv = { - silent: true, - cwd: ctx.project.path, - }; - - // Certain framework scaffolders commit by default, which implies that they initialize a git repo. - // If that's the case and we are in a repo, so we should skip this step. - if (!isInsideGitRepo(ctx.project.path)) { - await runCommand(["git", "init"], cmdEnv); - await runCommand(["git", "add", "."], cmdEnv); - - const commitMessage = `Initial commit by ${cli}`; - await runCommand(["git", "commit", "-m", commitMessage], cmdEnv); - } - } }; diff --git a/packages/create-cloudflare/turbo.json b/packages/create-cloudflare/turbo.json index 0302314d9ad9..86f36e6bdefd 100644 --- a/packages/create-cloudflare/turbo.json +++ b/packages/create-cloudflare/turbo.json @@ -16,7 +16,6 @@ }, "test:e2e": { "env": [ - "SAVE_DIFFS", "CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN", "FRAMEWORK_CLI_TO_TEST",