Commit b30bd2a
authored
ci: pre-warm Namespace cache for unit/component-view test shards (#30098)
## Summary
Introduces a \`prepare-ci-js-deps\` job and a \`setup-ci-js-deps\`
composite action to eliminate redundant \`yarn install\` + \`yarn
setup:github-ci --node\` across 13 CI shards (10 unit-test + 2
component-view + 1 merge job).
### What changed
**New job \`prepare-ci-js-deps\` (\`ci.yml\`)**
Runs before \`unit-tests\`, \`component-view-tests\`, and
\`merge-unit-and-component-view-tests\` and installs dependencies once
on behalf of all consumers.
- **Namespace runners**: mounts the persistent cache volume and runs
install only when the volume is cold (yarn.lock changed in the pool).
Consumers restore from the same volume — install is skipped entirely on
a warm cache.
- **Non-Namespace runners** (current default for all PRs): runs install,
then packs \`node_modules\` + generated files into a gzipped tarball
(\`ci-js-deps.tar.gz\`) and uploads it as a workflow-run artifact.
Consumers download and extract the tarball instead of running their own
install.
> **TEMP**: The tarball artifact path is a temporary fallback while
Namespace is on trial. Once Namespace becomes the default runner, the
pack/upload steps in the producer and the download/extract steps in each
consumer can be deleted. The \`setup-ci-js-deps\` composite action
requires no changes.
**New composite action \`.github/actions/setup-ci-js-deps\`**
Shared setup sequence used by the producer and all three consumer jobs:
1. Mount Namespace cache (Namespace only)
2. \`actions/setup-node\`
3. File-based freshness check (\`node_modules\` dir +
\`termsOfUseContent.ts\`)
4. \`yarn install --immutable\` + \`yarn setup:github-ci --node\` — only
if step 3 finds files missing
On non-Namespace consumers, step 3 finds the tarball already extracted,
so step 4 is skipped.
**Consumer jobs (\`unit-tests\`, \`component-view-tests\`,
\`merge-unit-and-component-view-tests\`)**
Each job's setup block is replaced with:
- TEMP: download + extract \`ci-js-deps.tar.gz\` (non-Namespace only;
tar preserves permissions so no separate restore step is needed)
- Call to \`setup-ci-js-deps\` (which skips install when files are
already present)
**\`check-all-jobs-pass\`**
\`prepare-ci-js-deps\` added to the gate.
### Not changed
- \`setup-node-modules.yml\` — untouched
- E2E jobs — untouched (Phase 2 scope)
## Estimated impact
| Lane | Shards | Before | After (non-Namespace) | After (Namespace) |
|---|---|---|---|---|
| \`unit-tests\` | 10 | ~2 min install each | ~30s download+extract |
~10s cache hit |
| \`component-view-tests\` | 2 | ~2 min install each | ~30s
download+extract | ~10s cache hit |
| \`merge-unit-and-component-view-tests\` | 1 | ~2 min install | ~30s
download+extract | ~10s cache hit |
| **Saved per run** | | | **~22 runner-min** | **~26 runner-min** |
## Removal guide (when Namespace passes trial)
Search for \`# TEMP\` in \`ci.yml\` — there are exactly 4 clearly marked
blocks:
1. \`Pack CI JS deps\` + \`Upload CI JS deps artifact\` in
\`prepare-ci-js-deps\`
2. \`Download CI JS deps artifact\` + \`Extract CI JS deps\` in each of
the 3 consumer jobs
Delete those blocks. No changes needed to
\`setup-ci-js-deps/action.yml\`.
## Manual testing steps
\`\`\`gherkin
Given a pull request runs CI on a non-Namespace runner (ubuntu-latest)
When prepare-ci-js-deps completes
Then a ci-js-deps.tar.gz artifact is uploaded
And each unit-tests and component-view-tests shard downloads and
extracts it
And all shards skip yarn install and pass
Given a pull request runs CI on a Namespace runner
When prepare-ci-js-deps completes on a warm cache volume
Then all consumer shards mount the cache volume and skip yarn install
And all shards pass
Given the Namespace cache volume is cold (yarn.lock changed)
When prepare-ci-js-deps runs
Then it installs dependencies and warms the volume
And all consumer shards hit the warm volume and skip install
\`\`\`
## References
- ADR: \`docs/ci-dependency-setup-reuse-adr.md\`
- Related action: \`.github/actions/restore-node-modules-permissions\`
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes CI job dependencies and dependency-caching behavior for
unit/component-view shards; misconfiguration could cause flaky installs
or missing artifacts, but impact is limited to CI execution.
>
> **Overview**
> **Reduces redundant JS dependency setup across CI test shards.** Adds
a new composite action `setup-ci-js-deps` that configures Namespace
cache, sets up Node, and conditionally runs `yarn install --immutable` +
`yarn setup:github-ci --node` based on workspace freshness.
>
> Introduces a `prepare-ci-js-deps` job that runs once before
`unit-tests`, `component-view-tests`, and
`merge-unit-and-component-view-tests` to warm Namespace shared cache;
for non-Namespace runners it packs and uploads a short-lived
`ci-js-deps` artifact that consumer shards download/extract to skip
their own installs.
>
> Updates test/merge jobs to depend on `prepare-ci-js-deps`, replaces
their inline dependency setup with the new action + temporary artifact
restore steps, tightens `if` conditions to require successful
`get_requirements`, and adds `prepare-ci-js-deps` to the
`check-all-jobs-pass` gate.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d9e8501. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent b90a311 commit b30bd2a
2 files changed
Lines changed: 130 additions & 83 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
603 | 631 | | |
604 | 632 | | |
605 | 633 | | |
606 | | - | |
| 634 | + | |
607 | 635 | | |
608 | 636 | | |
| 637 | + | |
609 | 638 | | |
610 | 639 | | |
611 | 640 | | |
| |||
614 | 643 | | |
615 | 644 | | |
616 | 645 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
627 | 651 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
632 | 658 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
| 659 | + | |
639 | 660 | | |
640 | 661 | | |
641 | 662 | | |
| |||
681 | 702 | | |
682 | 703 | | |
683 | 704 | | |
684 | | - | |
| 705 | + | |
685 | 706 | | |
686 | 707 | | |
687 | 708 | | |
688 | 709 | | |
689 | 710 | | |
690 | 711 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
710 | 717 | | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
716 | 724 | | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
| 725 | + | |
723 | 726 | | |
724 | 727 | | |
725 | 728 | | |
| |||
879 | 882 | | |
880 | 883 | | |
881 | 884 | | |
882 | | - | |
| 885 | + | |
883 | 886 | | |
884 | 887 | | |
| 888 | + | |
885 | 889 | | |
886 | 890 | | |
887 | 891 | | |
| |||
890 | 894 | | |
891 | 895 | | |
892 | 896 | | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
912 | 902 | | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
918 | 909 | | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
| 910 | + | |
925 | 911 | | |
926 | 912 | | |
927 | 913 | | |
| |||
1288 | 1274 | | |
1289 | 1275 | | |
1290 | 1276 | | |
| 1277 | + | |
1291 | 1278 | | |
1292 | 1279 | | |
1293 | 1280 | | |
| |||
0 commit comments