ci: fail PRs on invalid allowBuilds entries in pnpm-workspace.yaml (#18564)
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8f25cf9edb
commit
eac6ba5ae9
2 files changed
+23
-1
No files matched your search
@@ -22,6 +22,7 @@ import {
|
||||
DesktopDmgBackgroundSourceMissingError,
|
||||
createStageWorkspaceConfig,
|
||||
createStagePatchedDependencies,
|
||||
readWorkspaceConfig,
|
||||
createBuildConfig,
|
||||
DESKTOP_ELECTRON_LANGUAGES,
|
||||
DESKTOP_FILE_EXCLUSIONS,
|
||||
@@ -497,6 +498,25 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
});
|
||||
});
|
||||
|
||||
// pnpm writes "set this to true or false" placeholders into allowBuilds when a
|
||||
// tarball changes. pnpm ignores them, but the release build decode rejects them.
|
||||
it.effect("decodes the repo allowBuilds and every file: tarball it names exists", () =>
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const { allowBuilds = {} } = yield* readWorkspaceConfig();
|
||||
const repoRoot = path.join(import.meta.dirname, "..");
|
||||
for (const key of Object.keys(allowBuilds)) {
|
||||
const tarball = key.split("@file:")[1];
|
||||
if (tarball === undefined) continue;
|
||||
assert.isTrue(
|
||||
yield* fs.exists(path.join(repoRoot, tarball)),
|
||||
`allowBuilds names a missing tarball: ${key}`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
it("stages pnpm 11 allowBuilds and patchedDependencies in the workspace yaml", () => {
|
||||
assert.deepStrictEqual(
|
||||
createStageWorkspaceConfig({
|
||||
|
||||
@@ -111,7 +111,9 @@ const encodeJsonString = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknow
|
||||
const decodeWorkspaceConfig = Schema.decodeEffect(fromYaml(WorkspaceConfig));
|
||||
const encodeStageWorkspaceConfig = Schema.encodeEffect(fromYaml(StageWorkspaceConfig));
|
||||
|
||||
const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
|
||||
// Decodes the repo's pnpm-workspace.yaml. A PR CI test calls this too, so a bad
|
||||
// entry fails the PR instead of the nightly desktop build.
|
||||
export const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const repoRoot = yield* RepoRoot;
|
||||
|
||||
Reference in new issue
Block a user