USWDS-Site: Speed up CircleCI build - #3274
Merged
Merged
Conversation
ethangardner
marked this pull request as ready for review
July 31, 2026 14:45
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improved CircleCI build performance by implementing true parallel accessibility testing and optimizing dependency caching.
Related issue
Closes #3275
Problem statement
The CircleCI build had two inefficiencies:
Duplicate a11y testing: Jobs were configured with
parallelism: 2, but both containers ran the exact same full sitemap through pa11y-ci, resulting in both containers doing scans across the entire sitemap instead of dividing the work in half..Suboptimal caching: Dependency caches lacked fallback keys and didn't follow CircleCI best practices, leading to full reinstalls when lockfiles changed and caching the wrong paths for npm (caching
node_modulesinstead of~/.npm).Solution
Implemented true parallelism and improved caching:
Created sitemap sharding script (
config/shard-sitemap.mjs): Fetches the sitemap at test-time, validates and filters URLs, then splits them round-robin across CircleCI containers. This ensures each of the 2 containers tests a distinct half of the site.Updated CircleCI config:
pa11y-ci:sitemapcalls withpa11y-ci:shardin desktop/mobile a11y jobs--skip-initial-buildflag tojekyll servesince assets are pre-builtImproved dependency caching:
node_modulesto~/.npm(npm's download store)bundle clean --forceto remove stale gems after partial cache restoresv1-) for easy cache invalidationMajor changes
config/shard-sitemap.mjs— sitemap URL sharding script with origin validationpa11y-ci:shardandpa11y-ci:shard-mobilenpm scriptsTesting and review
To verify these changes:
The a11y tests should pass with identical coverage to the previous approach, just faster. Build time went from 14-16 minutes down to 8-9 in my testing.