Skip to content

ENG-3233: Optimize Cypress CI with shared build and better sharding#7792

Draft
gilluminate wants to merge 6 commits intomainfrom
gill/ENG-3233/optimize-cypress-ci
Draft

ENG-3233: Optimize Cypress CI with shared build and better sharding#7792
gilluminate wants to merge 6 commits intomainfrom
gill/ENG-3233/optimize-cypress-ci

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented Mar 31, 2026

Ticket ENG-3233

Description Of Changes

Optimize the Admin UI Cypress CI workflow to reduce wall-time and total compute. Each of the 5 parallel matrix jobs was independently running npm ci (~1m20s) and next build (~4min), duplicating ~6 min of build work per job (~30 min total wasted compute). The actual Cypress test execution was only 4-7 min per shard.

Code Changes

  • Extract a dedicated build job that runs npm ci + builds once, compresses artifacts into a tarball, and uploads for matrix jobs to download - eliminates redundant build work
  • Run build and prepare-matrix in parallel since they have no dependency on each other, shaving ~30s of serial wait
  • Replace the test-count-based sharding heuristic (it( / test( occurrences) with file-size-based bin-packing, which better correlates with actual execution time since heavier tests have more intercepts, fixtures, and setup code
  • Increase parallel groups from 5 to 7, which is now more cost-effective since per-job overhead drops from ~6 min (full build) to ~30s (artifact download)
  • Update the Summary job to gate on the new build job

Steps to Confirm

  1. Open this PR and confirm the Cypress workflow triggers (the workflow file is in the paths filter)
  2. Verify the build job completes and uploads the cypress-build artifact
  3. Verify all 7 matrix jobs download the artifact and run tests without npm ci or next build steps
  4. Compare total wall time against a recent run on main (target: ~8 min vs current ~13 min)
  5. Check that sharding is reasonably balanced by comparing per-job Cypress execution times in the Actions logs

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

gilluminate and others added 2 commits March 30, 2026 20:17
- Add a dedicated build job that runs npm ci + next build once and
  shares the artifact across all matrix jobs, eliminating ~5 min of
  redundant build work per shard
- Replace test-count sharding heuristic with file-size-based
  bin-packing, which better correlates with actual execution time
- Increase parallel groups from 5 to 7 to reduce wall time per shard
- Run build and prepare-matrix in parallel since they're independent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Mar 31, 2026 3:42am
fides-privacy-center Ignored Ignored Mar 31, 2026 3:42am

Request Review

gilluminate and others added 4 commits March 30, 2026 20:30
The Cypress binary lives at ~/.cache/Cypress, not in node_modules,
so it wasn't included in the shared build artifact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use actions/cache keyed on package-lock.json hash to persist
node_modules and ~/.cache/Cypress between workflow runs. The build
artifact now only carries .next and fides-js/dist, which are the
only outputs that change per-commit.

On cache hit the build job skips npm ci entirely. Matrix jobs use
a read-only cache restore (fail-on-cache-miss since the build job
always runs first and populates the cache).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant