From 59f828a028062004e6dea6330203eeef17dad798 Mon Sep 17 00:00:00 2001 From: Steven Serrata <9343811+sserrata@users.noreply.github.com> Date: Tue, 1 Jul 2025 06:55:26 -0500 Subject: [PATCH] Increase visual diff concurrency --- .github/workflows/deploy-preview.yml | 2 +- scripts/sitemap-visual-diff.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index ce09c273f..f0405b89c 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -177,7 +177,7 @@ jobs: run: npx playwright install --with-deps chromium - name: Run visual diff - run: yarn ts-node scripts/sitemap-visual-diff.ts --preview-url ${{ needs.deploy.outputs.preview_url }} --summary-file visual_diffs/results.json --concurrency 2 + 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/" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 if: always() diff --git a/scripts/sitemap-visual-diff.ts b/scripts/sitemap-visual-diff.ts index 564263d29..9a60ae153 100644 --- a/scripts/sitemap-visual-diff.ts +++ b/scripts/sitemap-visual-diff.ts @@ -23,6 +23,7 @@ interface Options { concurrency: number; diffAlpha: number; summaryFile: string; + paths: string; } function parseArgs(): Options { @@ -36,6 +37,7 @@ function parseArgs(): Options { concurrency: 4, diffAlpha: 1, summaryFile: "visual_diffs/results.json", + paths: "", }; for (let i = 0; i < args.length; i++) { const arg = args[i]; @@ -72,6 +74,10 @@ function parseArgs(): Options { case "--summary-file": opts.summaryFile = args[++i]; break; + case "-P": + case "--paths": + opts.paths = args[++i]; + break; } } return opts; @@ -168,7 +174,11 @@ async function run() { const sitemapXml = await fetchSitemap( "https://docusaurus-openapi.tryingpan.dev/sitemap.xml" ); - const paths = parseUrlsFromSitemap(await sitemapXml); + let paths = parseUrlsFromSitemap(sitemapXml); + if (opts.paths) { + const regex = new RegExp(opts.paths); + paths = paths.filter((p) => regex.test(p)); + } console.log(`Found ${paths.length} paths.`); const browser = await chromium.launch();