Skip to content

Commit

Permalink
chore: stop uploading c3 diff (#7043)
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung authored Oct 22, 2024
1 parent 6b97353 commit f9e9134
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 190 deletions.
98 changes: 0 additions & 98 deletions .github/actions/create-c3-docs-pr/action.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/actions/run-c3-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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' }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/c3-e2e-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions .github/workflows/c3-e2e-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}}
1 change: 0 additions & 1 deletion .github/workflows/c3-e2e-quarantine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ jobs:
quarantine: true
accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }}
saveDiffs: false
2 changes: 0 additions & 2 deletions .github/workflows/c3-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}}
9 changes: 0 additions & 9 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion packages/create-cloudflare/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion packages/create-cloudflare/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules
/dist
create-cloudflare-*.tgz
/.e2e-logs*/*
/.e2e-diffs*/*

.DS_Store

Expand Down
28 changes: 2 additions & 26 deletions packages/create-cloudflare/e2e-tests/frameworks.test.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand Down Expand Up @@ -417,7 +414,6 @@ describe.concurrent(
() => {
beforeAll(async (ctx) => {
recreateLogFolder({ experimental }, ctx);
recreateDiffsFolder({ experimental });
});

Object.keys(frameworkTests).forEach((frameworkId) => {
Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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);
Expand Down
16 changes: 0 additions & 16 deletions packages/create-cloudflare/e2e-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 0 additions & 20 deletions packages/create-cloudflare/src/frameworks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
}
}
};
1 change: 0 additions & 1 deletion packages/create-cloudflare/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"test:e2e": {
"env": [
"SAVE_DIFFS",
"CLOUDFLARE_ACCOUNT_ID",
"CLOUDFLARE_API_TOKEN",
"FRAMEWORK_CLI_TO_TEST",
Expand Down

0 comments on commit f9e9134

Please sign in to comment.