-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C3: Add e2e coverage for deployment (#3658)
* C3: Add e2e coverage for deployment * PR feedback * Adding cleanup script for test projects * C3: Run framework e2e tests concurrently * Fixing project cleanup and tweaking test concurrency
- Loading branch information
Showing
8 changed files
with
211 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/create-cloudflare/scripts/cleanupPagesProject.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { execa } from "execa"; | ||
|
||
if (!process.env.CLOUDFLARE_API_TOKEN) { | ||
console.error("CLOUDFLARE_API_TOKEN must be set"); | ||
process.exit(1); | ||
} | ||
|
||
if (!process.env.CLOUDFLARE_ACCOUNT_ID) { | ||
console.error("CLOUDFLARE_ACCOUNT_ID must be set"); | ||
process.exit(1); | ||
} | ||
|
||
const npx = async (args) => { | ||
const argv = args.split(" "); | ||
return execa("npx", argv); | ||
}; | ||
|
||
const listProjectsToDelete = async () => { | ||
const toDelete = []; | ||
|
||
const { stdout } = await npx("wrangler pages project list"); | ||
|
||
for (const line of stdout.split("\n")) { | ||
const c3ProjectRe = /(c3-e2e-[\w-]*)\s?│/; | ||
const match = line.match(c3ProjectRe); | ||
|
||
if (match) { | ||
toDelete.push(match[1]); | ||
} | ||
} | ||
|
||
return toDelete; | ||
}; | ||
|
||
const deleteProjects = async (projects) => { | ||
for (const project of projects) { | ||
try { | ||
console.log(`Deleting project: ${project}`); | ||
await npx(`wrangler pages project delete -y ${project}`); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
}; | ||
|
||
const projects = await listProjectsToDelete(); | ||
deleteProjects(projects); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.