Skip to content

Commit 0dfe328

Browse files
authored
Increase visual diff concurrency (#1187)
1 parent 090d038 commit 0dfe328

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/deploy-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
run: npx playwright install --with-deps chromium
178178

179179
- name: Run visual diff
180-
run: yarn ts-node scripts/sitemap-visual-diff.ts --preview-url ${{ needs.deploy.outputs.preview_url }} --summary-file visual_diffs/results.json --concurrency 2
180+
run: yarn ts-node scripts/sitemap-visual-diff.ts --preview-url ${{ needs.deploy.outputs.preview_url }} --summary-file visual_diffs/results.json --concurrency 4 --paths "/tests/"
181181

182182
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
183183
if: always()

scripts/sitemap-visual-diff.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface Options {
2323
concurrency: number;
2424
diffAlpha: number;
2525
summaryFile: string;
26+
paths: string;
2627
}
2728

2829
function parseArgs(): Options {
@@ -36,6 +37,7 @@ function parseArgs(): Options {
3637
concurrency: 4,
3738
diffAlpha: 1,
3839
summaryFile: "visual_diffs/results.json",
40+
paths: "",
3941
};
4042
for (let i = 0; i < args.length; i++) {
4143
const arg = args[i];
@@ -72,6 +74,10 @@ function parseArgs(): Options {
7274
case "--summary-file":
7375
opts.summaryFile = args[++i];
7476
break;
77+
case "-P":
78+
case "--paths":
79+
opts.paths = args[++i];
80+
break;
7581
}
7682
}
7783
return opts;
@@ -168,7 +174,11 @@ async function run() {
168174
const sitemapXml = await fetchSitemap(
169175
"https://docusaurus-openapi.tryingpan.dev/sitemap.xml"
170176
);
171-
const paths = parseUrlsFromSitemap(await sitemapXml);
177+
let paths = parseUrlsFromSitemap(sitemapXml);
178+
if (opts.paths) {
179+
const regex = new RegExp(opts.paths);
180+
paths = paths.filter((p) => regex.test(p));
181+
}
172182
console.log(`Found ${paths.length} paths.`);
173183

174184
const browser = await chromium.launch();

0 commit comments

Comments
 (0)