Skip to content

Commit b830577

Browse files
authored
chore(ci): Use global yarn cache only (reduce cache usage) (#6628)
1 parent 146798a commit b830577

File tree

4 files changed

+83
-154
lines changed

4 files changed

+83
-154
lines changed

.github/workflows/cloud.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,15 @@ jobs:
7878
node-version: ${{ matrix.node-version }}
7979
- name: Get yarn cache directory path
8080
id: yarn-cache-dir-path
81-
run: echo "::set-output name=dir::$(yarn cache dir)"
82-
- name: Restore lerna
81+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
82+
shell: bash
83+
- name: Restore yarn cache
8384
uses: actions/cache@v3
8485
with:
85-
path: |
86-
${{ steps.yarn-cache-dir-path.outputs.dir }}
87-
node_modules
88-
rust/node_modules
89-
packages/*/node_modules
90-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
86+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
87+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
9188
restore-keys: |
92-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
89+
${{ runner.os }}-yarn-
9390
- name: Set Yarn version
9491
run: yarn policies set-version v1.22.19
9592
- name: Yarn install

.github/workflows/publish.yml

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,15 @@ jobs:
2626
node-version: 16.x
2727
- name: Get yarn cache directory path
2828
id: yarn-cache-dir-path
29-
run: echo "::set-output name=dir::$(yarn cache dir)"
30-
- name: Restore lerna
29+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
30+
shell: bash
31+
- name: Restore yarn cache
3132
uses: actions/cache@v3
3233
with:
33-
path: |
34-
${{ steps.yarn-cache-dir-path.outputs.dir }}
35-
node_modules
36-
rust/cubestore/node_modules
37-
packages/*/node_modules
38-
key: ${{ runner.os }}-workspace-main-16.x-${{ hashFiles('**/yarn.lock') }}
34+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
35+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3936
restore-keys: |
40-
${{ runner.os }}-workspace-main-16.x-
37+
${{ runner.os }}-yarn-
4138
- name: Set Yarn version
4239
run: yarn policies set-version v1.22.19
4340
- name: Copy yarn.lock file
@@ -104,18 +101,15 @@ jobs:
104101
node-version: ${{ matrix.node-version }}
105102
- name: Get yarn cache directory path
106103
id: yarn-cache-dir-path
107-
run: echo "::set-output name=dir::$(yarn cache dir)"
108-
- name: Restore lerna
104+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
105+
shell: bash
106+
- name: Restore yarn cache
109107
uses: actions/cache@v3
110108
with:
111-
path: |
112-
${{ steps.yarn-cache-dir-path.outputs.dir }}
113-
node_modules
114-
rust/cubesql/node_modules
115-
packages/*/node_modules
116-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
109+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
110+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
117111
restore-keys: |
118-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
112+
${{ runner.os }}-yarn-
119113
- name: Install Yarn
120114
run: npm install -g yarn
121115
- name: Set Yarn version
@@ -178,31 +172,15 @@ jobs:
178172
node-version: ${{ matrix.node-version }}
179173
- name: Get yarn cache directory path
180174
id: yarn-cache-dir-path
181-
run: echo "::set-output name=dir::$(yarn cache dir)"
182-
- name: Restore lerna (excluding windows)
183-
uses: actions/cache@v3
184-
if: ${{ !startsWith(matrix.os-version, 'windows') }}
185-
with:
186-
path: |
187-
${{ steps.yarn-cache-dir-path.outputs.dir }}
188-
node_modules
189-
rust/cubesql/node_modules
190-
packages/*/node_modules
191-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
192-
restore-keys: |
193-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
194-
# Windows doesn't support links + cache action doesn't support exclude
195-
# cache will include rust cache for native, which causes 3GB archive
196-
# Right now, GH provides 10 gb for each repository with automatic retention.
197-
- name: Restore lerna (Windows only)
175+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
176+
shell: bash
177+
- name: Restore yarn cache
198178
uses: actions/cache@v3
199-
if: ${{ startsWith(matrix.os-version, 'windows') }}
200179
with:
201-
path: |
202-
${{ steps.yarn-cache-dir-path.outputs.dir }}
203-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
180+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
181+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
204182
restore-keys: |
205-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
183+
${{ runner.os }}-yarn-
206184
- name: Set Yarn version
207185
run: yarn policies set-version v1.22.19
208186
- name: Copy yarn.lock file

.github/workflows/push.yml

Lines changed: 48 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,15 @@ jobs:
6868
node-version: ${{ matrix.node-version }}
6969
- name: Get yarn cache directory path
7070
id: yarn-cache-dir-path
71-
run: echo "::set-output name=dir::$(yarn cache dir)"
72-
- name: Restore lerna
71+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
72+
shell: bash
73+
- name: Restore yarn cache
7374
uses: actions/cache@v3
7475
with:
75-
path: |
76-
${{ steps.yarn-cache-dir-path.outputs.dir }}
77-
node_modules
78-
rust/cubestore/node_modules
79-
packages/*/node_modules
80-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
76+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
77+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
8178
restore-keys: |
82-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
79+
${{ runner.os }}-yarn-
8380
- name: Set Yarn version
8481
run: yarn policies set-version v1.22.19
8582
- name: Yarn install
@@ -126,18 +123,15 @@ jobs:
126123
node-version: 16.x
127124
- name: Get yarn cache directory path
128125
id: yarn-cache-dir-path
129-
run: echo "::set-output name=dir::$(yarn cache dir)"
130-
- name: Restore lerna
126+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
127+
shell: bash
128+
- name: Restore yarn cache
131129
uses: actions/cache@v3
132130
with:
133-
path: |
134-
${{ steps.yarn-cache-dir-path.outputs.dir }}
135-
node_modules
136-
rust/cubestore/node_modules
137-
packages/*/node_modules
138-
key: ${{ runner.os }}-workspace-main-16.x-${{ hashFiles('**/yarn.lock') }}
131+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
132+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
139133
restore-keys: |
140-
${{ runner.os }}-workspace-main-16.x-
134+
${{ runner.os }}-yarn-
141135
- name: Set Yarn version
142136
run: yarn policies set-version v1.22.19
143137
- name: Yarn install
@@ -176,18 +170,15 @@ jobs:
176170
node-version: 16.x
177171
- name: Get yarn cache directory path
178172
id: yarn-cache-dir-path
179-
run: echo "::set-output name=dir::$(yarn cache dir)"
180-
- name: Restore lerna
173+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
174+
shell: bash
175+
- name: Restore yarn cache
181176
uses: actions/cache@v3
182177
with:
183-
path: |
184-
${{ steps.yarn-cache-dir-path.outputs.dir }}
185-
node_modules
186-
rust/cubestore/node_modules
187-
packages/*/node_modules
188-
key: ${{ runner.os }}-workspace-main-16.x-${{ hashFiles('**/yarn.lock') }}
178+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
179+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
189180
restore-keys: |
190-
${{ runner.os }}-workspace-main-16.x-
181+
${{ runner.os }}-yarn-
191182
- name: Set Yarn version
192183
run: yarn policies set-version v1.22.19
193184
- name: Yarn install
@@ -246,18 +237,15 @@ jobs:
246237
node-version: ${{ matrix.node-version }}
247238
- name: Get yarn cache directory path
248239
id: yarn-cache-dir-path
249-
run: echo "::set-output name=dir::$(yarn cache dir)"
250-
- name: Restore lerna
240+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
241+
shell: bash
242+
- name: Restore yarn cache
251243
uses: actions/cache@v3
252244
with:
253-
path: |
254-
${{ steps.yarn-cache-dir-path.outputs.dir }}
255-
node_modules
256-
rust/cubestore/node_modules
257-
packages/*/node_modules
258-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
245+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
246+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
259247
restore-keys: |
260-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
248+
${{ runner.os }}-yarn-
261249
- name: Set Yarn version
262250
run: yarn policies set-version v1.22.19
263251
- name: Yarn install
@@ -327,18 +315,15 @@ jobs:
327315
node-version: ${{ matrix.node-version }}
328316
- name: Get yarn cache directory path
329317
id: yarn-cache-dir-path
330-
run: echo "::set-output name=dir::$(yarn cache dir)"
331-
- name: Restore lerna
318+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
319+
shell: bash
320+
- name: Restore yarn cache
332321
uses: actions/cache@v3
333322
with:
334-
path: |
335-
${{ steps.yarn-cache-dir-path.outputs.dir }}
336-
node_modules
337-
rust/cubestore/node_modules
338-
packages/*/node_modules
339-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
323+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
324+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
340325
restore-keys: |
341-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
326+
${{ runner.os }}-yarn-
342327
- name: Set Yarn version
343328
run: yarn policies set-version v1.22.19
344329
- name: Yarn install
@@ -399,18 +384,15 @@ jobs:
399384
node-version: ${{ matrix.node-version }}
400385
- name: Get yarn cache directory path
401386
id: yarn-cache-dir-path
402-
run: echo "::set-output name=dir::$(yarn cache dir)"
403-
- name: Restore lerna
387+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
388+
shell: bash
389+
- name: Restore yarn cache
404390
uses: actions/cache@v3
405391
with:
406-
path: |
407-
${{ steps.yarn-cache-dir-path.outputs.dir }}
408-
node_modules
409-
rust/node_modules
410-
packages/*/node_modules
411-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
392+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
393+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
412394
restore-keys: |
413-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
395+
${{ runner.os }}-yarn-
414396
- name: Set Yarn version
415397
run: yarn policies set-version v1.22.19
416398
- name: Yarn install
@@ -455,18 +437,15 @@ jobs:
455437
node-version: ${{ matrix.node-version }}
456438
- name: Get yarn cache directory path
457439
id: yarn-cache-dir-path
458-
run: echo "::set-output name=dir::$(yarn cache dir)"
459-
- name: Restore lerna
440+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
441+
shell: bash
442+
- name: Restore yarn cache
460443
uses: actions/cache@v3
461444
with:
462-
path: |
463-
${{ steps.yarn-cache-dir-path.outputs.dir }}
464-
node_modules
465-
rust/node_modules
466-
packages/*/node_modules
467-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
445+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
446+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
468447
restore-keys: |
469-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
448+
${{ runner.os }}-yarn-
470449
- name: Set Yarn version
471450
run: yarn policies set-version v1.22.19
472451
- name: Yarn install
@@ -585,18 +564,15 @@ jobs:
585564
node-version: 16.x
586565
- name: Get yarn cache directory path
587566
id: yarn-cache-dir-path
588-
run: echo "::set-output name=dir::$(yarn cache dir)"
589-
- name: Restore lerna
567+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
568+
shell: bash
569+
- name: Restore yarn cache
590570
uses: actions/cache@v3
591571
with:
592-
path: |
593-
${{ steps.yarn-cache-dir-path.outputs.dir }}
594-
node_modules
595-
rust/cubestore/node_modules
596-
packages/*/node_modules
597-
key: ${{ runner.os }}-workspace-main-16.x-${{ hashFiles('**/yarn.lock') }}
572+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
573+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
598574
restore-keys: |
599-
${{ runner.os }}-workspace-main-16.x-
575+
${{ runner.os }}-yarn-
600576
- name: Set Yarn version
601577
run: yarn policies set-version v1.22.19
602578
- name: Yarn install

.github/workflows/rust-cubesql.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,14 @@ jobs:
157157
run: yarn policies set-version v1.22.19
158158
- name: Get yarn cache directory path
159159
id: yarn-cache-dir-path
160-
run: echo "::set-output name=dir::$(yarn cache dir)"
161-
- name: Restore lerna
160+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
161+
- name: Restore yarn cache
162162
uses: actions/cache@v3
163163
with:
164-
path: |
165-
${{ steps.yarn-cache-dir-path.outputs.dir }}
166-
node_modules
167-
rust/cubesql/node_modules
168-
packages/*/node_modules
169-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
164+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
165+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
170166
restore-keys: |
171-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
167+
${{ runner.os }}-yarn-
172168
- name: Yarn install
173169
uses: nick-invision/retry@v2
174170
env:
@@ -227,37 +223,19 @@ jobs:
227223
uses: actions/setup-node@v3
228224
with:
229225
node-version: ${{ matrix.node-version }}
230-
- name: Install Yarn
231-
run: npm install -g yarn
232226
- name: Set Yarn version
233227
run: yarn policies set-version v1.22.19
234228
- name: Get yarn cache directory path
235229
id: yarn-cache-dir-path
236-
run: echo "::set-output name=dir::$(yarn cache dir)"
237-
- name: Restore lerna (excluding Windows)
238-
uses: actions/cache@v3
239-
if: ${{ !startsWith(matrix.os-version, 'windows') }}
240-
with:
241-
path: |
242-
${{ steps.yarn-cache-dir-path.outputs.dir }}
243-
node_modules
244-
rust/cubesql/node_modules
245-
packages/*/node_modules
246-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
247-
restore-keys: |
248-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
249-
# Windows doesn't support links + cache action doesn't support exclude
250-
# cache will include rust cache for native, which causes 3GB archive
251-
# Right now, GH provides 10 gb for each repository with automatic retention.
252-
- name: Restore lerna (Windows only)
230+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
231+
shell: bash
232+
- name: Restore yarn cache
253233
uses: actions/cache@v3
254-
if: ${{ startsWith(matrix.os-version, 'windows') }}
255234
with:
256-
path: |
257-
${{ steps.yarn-cache-dir-path.outputs.dir }}
258-
key: ${{ runner.os }}-workspace-main-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
235+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
236+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
259237
restore-keys: |
260-
${{ runner.os }}-workspace-main-${{ matrix.node-version }}-
238+
${{ runner.os }}-yarn-
261239
- name: Yarn install
262240
uses: nick-invision/retry@v2
263241
env:

0 commit comments

Comments
 (0)