Skip to content

Commit dcaa976

Browse files
committed
Cache node_modules for batches
1 parent a14471d commit dcaa976

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ jobs:
1717
uses: actions/setup-node@v4
1818
with:
1919
node-version: "22"
20+
cache: "npm"
21+
- name: Cache node_modules
22+
id: cache
23+
uses: actions/cache@v4
24+
with:
25+
path: node_modules
26+
key: npm-22-${{ hashFiles('package-lock.json') }}
27+
restore-keys: |
28+
npm-22-
2029
- name: Install Dependencies
30+
if: steps.cache.outputs.cache-hit != 'true'
2131
run: npm ci
2232
- name: Run Linter
2333
run: npm run lint
@@ -55,8 +65,26 @@ jobs:
5565
uses: actions/setup-node@v4
5666
with:
5767
node-version: ${{ matrix.node-version }}
68+
cache: "npm"
69+
- name: Cache node_modules
70+
id: cache
71+
uses: actions/cache@v4
72+
with:
73+
path: node_modules
74+
key: npm-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
75+
restore-keys: |
76+
npm-${{ matrix.node-version }}-
5877
- name: Install Dependencies
78+
if: steps.cache.outputs.cache-hit != 'true'
5979
run: npm ci
80+
- name: Stagger integration start (reduce auth/server thundering)
81+
if: ${{ matrix.test == 'integration:v5:batch' }}
82+
run: |
83+
# Spread 15 integration jobs over ~30s so token endpoint isn't hammered
84+
case "${{ matrix.node-version }}" in 20) n=0;; 22) n=1;; 24) n=2;; *) n=0;; esac
85+
delay=$(( ${{ matrix.batch-index }} * 6 + n * 2 ))
86+
echo "Staggering ${delay}s before running tests (batch ${{ matrix.batch-index }}, node ${{ matrix.node-version }})"
87+
sleep "$delay"
6088
- name: Run ${{ matrix.test }} Tests and Add Annotations
6189
id: tests
6290
run: |

0 commit comments

Comments
 (0)