Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
--mount type=bind,src="$PWD/scripts",dst=/scripts,readonly --workdir /work \
"$image" bun /scripts/safe-extract.ts /source.tar.gz /work
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp --cap-drop=ALL --security-opt=no-new-privileges \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=128m \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=512m \
--mount type=bind,src="$project",dst=/work --workdir /work \
"$image" bun install --frozen-lockfile --ignore-scripts
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp --network=none --cap-drop=ALL --security-opt=no-new-privileges \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=128m \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=512m \
--mount type=bind,src="$project",dst=/work --workdir /work "$image" sh -c '
entrypoint="$(bun -e "const p=await Bun.file(\"package.json\").json();const e=p.temps?.entrypoint;if(typeof e!==\"string\"||!/^src\\/[a-zA-Z0-9_./-]+\\.tsx?$/.test(e)||e.includes(\"..\"))process.exit(1);console.log(e)")"
bun build "$entrypoint" --target=bun --compile --outfile /tmp/temps-plugin-check
Expand Down
4 changes: 4 additions & 0 deletions registry/site-crawl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"repo": "gotempsh/temps-plugin-site-crawl",
"categories": ["seo", "automation"]
}
11 changes: 11 additions & 0 deletions scripts/catalog-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ for (const path of ["../.github/workflows/catalog.yml", "./validate-build.sh"])
expect(source).toContain('--ignore-scripts');
});
}

for (const path of ["../.github/workflows/catalog.yml", "./validate-build.sh"]) {
test(`${path}: dependency extraction has bounded space for frontend toolchains`, async () => {
const source = await Bun.file(new URL(path, import.meta.url)).text();
const buildLimits = source.split("\n").filter(line => line.includes("--memory=2g"));
expect(buildLimits.length).toBeGreaterThan(0);
for (const line of buildLimits) {
expect(line).toContain("--tmpfs /tmp:rw,nosuid,nodev,size=512m");
}
});
}
4 changes: 2 additions & 2 deletions scripts/validate-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jq -c '.[]' "$scratch/plan.json" | while IFS= read -r item; do
--mount type=bind,src="$PWD/scripts",dst=/scripts,readonly \
--workdir /work "$image" bun /scripts/safe-extract.ts /source.tar.gz /work
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp --cap-drop=ALL --security-opt=no-new-privileges \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=128m \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=512m \
--mount type=bind,src="$project",dst=/work --workdir /work "$image" bun install --frozen-lockfile --ignore-scripts
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp --network=none --cap-drop=ALL --security-opt=no-new-privileges \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=128m \
--pids-limit=128 --memory=2g --cpus=2 --tmpfs /tmp:rw,nosuid,nodev,size=512m \
--mount type=bind,src="$project",dst=/work --workdir /work "$image" sh -c '
entrypoint="$(bun -e "const p=await Bun.file(\"package.json\").json();const e=p.temps?.entrypoint;if(typeof e!==\"string\"||!/^src\\/[a-zA-Z0-9_./-]+\\.tsx?$/.test(e)||e.includes(\"..\"))process.exit(1);console.log(e)")"
bun build "$entrypoint" --target=bun --compile --outfile /tmp/temps-plugin-check
Expand Down
Loading