Skip to content

Commit d604022

Browse files
authored
build: Improve CI cache (#7141)
1 parent 2c514ed commit d604022

File tree

6 files changed

+38
-35
lines changed

6 files changed

+38
-35
lines changed

.github/workflows/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# Parse version from head branch
2626
text: ${{ github.head_ref }}
2727
# match: preprare-release/xx.xx.xx
28-
regex: '^preprare-release\/(\d+\.\d+\.\d+)$'
28+
regex: '^prepare-release\/(\d+\.\d+\.\d+)$'
2929

3030
- name: Prepare release
3131
uses: getsentry/action-prepare-release@v1

.github/workflows/build.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ env:
4747
NX_CACHE_RESTORE_KEYS: |
4848
nx-Linux-${{ github.ref }}-${{ github.event.inputs.commit || github.sha }}
4949
nx-Linux-${{ github.ref }}
50-
nx-Linux-refs/heads/develop
5150
nx-Linux
5251
5352
jobs:
@@ -173,6 +172,7 @@ jobs:
173172
key: ${{ steps.compute_lockfile_hash.outputs.hash }}
174173

175174
- name: Install dependencies
175+
if: steps.cache_dependencies.outputs.cache_hit != 'true'
176176
run: yarn install --ignore-engines --frozen-lockfile
177177
outputs:
178178
dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }}
@@ -212,7 +212,7 @@ jobs:
212212
needs.job_get_metadata.outputs.is_release == 'false' &&
213213
needs.job_get_metadata.outputs.force_skip_cache == 'false'
214214
with:
215-
path: node_modules/.cache/nx
215+
path: .nxcache
216216
key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
217217
# On develop branch, we want to _store_ the cache (so it can be used by other branches), but never _restore_ from it
218218
restore-keys:
@@ -244,12 +244,12 @@ jobs:
244244
- name: Set up Node
245245
uses: volta-cli/action@v4
246246
- name: Check dependency cache
247-
uses: actions/cache@v3
247+
uses: actions/cache/restore@v3
248248
with:
249249
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
250250
key: ${{ needs.job_build.outputs.dependency_cache_key }}
251251
- name: Check build cache
252-
uses: actions/cache@v3
252+
uses: actions/cache/restore@v3
253253
with:
254254
path: ${{ env.CACHED_BUILD_PATHS }}
255255
key: ${{ env.BUILD_CACHE_KEY }}
@@ -288,12 +288,12 @@ jobs:
288288
# use Node 14 for now.
289289
node-version: '14'
290290
- name: Check dependency cache
291-
uses: actions/cache@v3
291+
uses: actions/cache/restore@v3
292292
with:
293293
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
294294
key: ${{ needs.job_build.outputs.dependency_cache_key }}
295295
- name: Check build cache
296-
uses: actions/cache@v3
296+
uses: actions/cache/restore@v3
297297
with:
298298
path: ${{ env.CACHED_BUILD_PATHS }}
299299
key: ${{ env.BUILD_CACHE_KEY }}
@@ -319,12 +319,12 @@ jobs:
319319
- name: Set up Node
320320
uses: volta-cli/action@v4
321321
- name: Check dependency cache
322-
uses: actions/cache@v3
322+
uses: actions/cache/restore@v3
323323
with:
324324
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
325325
key: ${{ needs.job_build.outputs.dependency_cache_key }}
326326
- name: Check build cache
327-
uses: actions/cache@v3
327+
uses: actions/cache/restore@v3
328328
with:
329329
path: ${{ env.CACHED_BUILD_PATHS }}
330330
key: ${{ env.BUILD_CACHE_KEY }}
@@ -344,12 +344,12 @@ jobs:
344344
- name: Set up Node
345345
uses: volta-cli/action@v4
346346
- name: Check dependency cache
347-
uses: actions/cache@v3
347+
uses: actions/cache/restore@v3
348348
with:
349349
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
350350
key: ${{ needs.job_build.outputs.dependency_cache_key }}
351351
- name: Check build cache
352-
uses: actions/cache@v3
352+
uses: actions/cache/restore@v3
353353
with:
354354
path: ${{ env.CACHED_BUILD_PATHS }}
355355
key: ${{ env.BUILD_CACHE_KEY }}
@@ -370,12 +370,12 @@ jobs:
370370
- name: Set up Node
371371
uses: volta-cli/action@v4
372372
- name: Check dependency cache
373-
uses: actions/cache@v3
373+
uses: actions/cache/restore@v3
374374
with:
375375
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
376376
key: ${{ needs.job_build.outputs.dependency_cache_key }}
377377
- name: Check build cache
378-
uses: actions/cache@v3
378+
uses: actions/cache/restore@v3
379379
with:
380380
path: ${{ env.CACHED_BUILD_PATHS }}
381381
key: ${{ env.BUILD_CACHE_KEY }}
@@ -407,12 +407,12 @@ jobs:
407407
with:
408408
node-version: ${{ env.DEFAULT_NODE_VERSION }}
409409
- name: Check dependency cache
410-
uses: actions/cache@v3
410+
uses: actions/cache/restore@v3
411411
with:
412412
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
413413
key: ${{ needs.job_build.outputs.dependency_cache_key }}
414414
- name: Check build cache
415-
uses: actions/cache@v3
415+
uses: actions/cache/restore@v3
416416
with:
417417
path: ${{ env.CACHED_BUILD_PATHS }}
418418
key: ${{ env.BUILD_CACHE_KEY }}
@@ -442,12 +442,12 @@ jobs:
442442
with:
443443
node-version: ${{ matrix.node }}
444444
- name: Check dependency cache
445-
uses: actions/cache@v3
445+
uses: actions/cache/restore@v3
446446
with:
447447
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
448448
key: ${{ needs.job_build.outputs.dependency_cache_key }}
449449
- name: Check build cache
450-
uses: actions/cache@v3
450+
uses: actions/cache/restore@v3
451451
with:
452452
path: ${{ env.CACHED_BUILD_PATHS }}
453453
key: ${{ env.BUILD_CACHE_KEY }}
@@ -480,12 +480,12 @@ jobs:
480480
with:
481481
node-version: ${{ matrix.node }}
482482
- name: Check dependency cache
483-
uses: actions/cache@v3
483+
uses: actions/cache/restore@v3
484484
with:
485485
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
486486
key: ${{ needs.job_build.outputs.dependency_cache_key }}
487487
- name: Check build cache
488-
uses: actions/cache@v3
488+
uses: actions/cache/restore@v3
489489
with:
490490
path: ${{ env.CACHED_BUILD_PATHS }}
491491
key: ${{ env.BUILD_CACHE_KEY }}
@@ -553,12 +553,12 @@ jobs:
553553
- name: Set up Node
554554
uses: volta-cli/action@v4
555555
- name: Check dependency cache
556-
uses: actions/cache@v3
556+
uses: actions/cache/restore@v3
557557
with:
558558
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
559559
key: ${{ needs.job_build.outputs.dependency_cache_key }}
560560
- name: Check build cache
561-
uses: actions/cache@v3
561+
uses: actions/cache/restore@v3
562562
with:
563563
path: ${{ env.CACHED_BUILD_PATHS }}
564564
key: ${{ env.BUILD_CACHE_KEY }}
@@ -611,12 +611,12 @@ jobs:
611611
- name: Set up Node
612612
uses: volta-cli/action@v4
613613
- name: Check dependency cache
614-
uses: actions/cache@v3
614+
uses: actions/cache/restore@v3
615615
with:
616616
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
617617
key: ${{ needs.job_build.outputs.dependency_cache_key }}
618618
- name: Check build cache
619-
uses: actions/cache@v3
619+
uses: actions/cache/restore@v3
620620
with:
621621
path: ${{ env.CACHED_BUILD_PATHS }}
622622
key: ${{ env.BUILD_CACHE_KEY }}
@@ -641,12 +641,12 @@ jobs:
641641
- name: Set up Node
642642
uses: volta-cli/action@v4
643643
- name: Check dependency cache
644-
uses: actions/cache@v3
644+
uses: actions/cache/restore@v3
645645
with:
646646
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
647647
key: ${{ needs.job_build.outputs.dependency_cache_key }}
648648
- name: Check build cache
649-
uses: actions/cache@v3
649+
uses: actions/cache/restore@v3
650650
with:
651651
path: ${{ env.CACHED_BUILD_PATHS }}
652652
key: ${{ env.BUILD_CACHE_KEY }}
@@ -679,12 +679,12 @@ jobs:
679679
with:
680680
node-version: ${{ matrix.node }}
681681
- name: Check dependency cache
682-
uses: actions/cache@v3
682+
uses: actions/cache/restore@v3
683683
with:
684684
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
685685
key: ${{ needs.job_build.outputs.dependency_cache_key }}
686686
- name: Check build cache
687-
uses: actions/cache@v3
687+
uses: actions/cache/restore@v3
688688
with:
689689
path: ${{ env.CACHED_BUILD_PATHS }}
690690
key: ${{ env.BUILD_CACHE_KEY }}
@@ -715,12 +715,12 @@ jobs:
715715
with:
716716
node-version: ${{ matrix.node }}
717717
- name: Check dependency cache
718-
uses: actions/cache@v3
718+
uses: actions/cache/restore@v3
719719
with:
720720
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
721721
key: ${{ needs.job_build.outputs.dependency_cache_key }}
722722
- name: Check build cache
723-
uses: actions/cache@v3
723+
uses: actions/cache/restore@v3
724724
with:
725725
path: ${{ env.CACHED_BUILD_PATHS }}
726726
key: ${{ env.BUILD_CACHE_KEY }}
@@ -749,12 +749,12 @@ jobs:
749749
- name: Set up Node
750750
uses: volta-cli/action@v4
751751
- name: Check dependency cache
752-
uses: actions/cache@v3
752+
uses: actions/cache/restore@v3
753753
with:
754754
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
755755
key: ${{ needs.job_build.outputs.dependency_cache_key }}
756756
- name: Check build cache
757-
uses: actions/cache@v3
757+
uses: actions/cache/restore@v3
758758
with:
759759
path: ${{ env.CACHED_BUILD_PATHS }}
760760
key: ${{ env.BUILD_CACHE_KEY }}
@@ -812,12 +812,12 @@ jobs:
812812
- name: Set up Node
813813
uses: volta-cli/action@v4
814814
- name: Check dependency cache
815-
uses: actions/cache@v3
815+
uses: actions/cache/restore@v3
816816
with:
817817
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
818818
key: ${{ needs.job_build.outputs.dependency_cache_key }}
819819
- name: Check build cache
820-
uses: actions/cache@v3
820+
uses: actions/cache/restore@v3
821821
with:
822822
path: ${{ env.CACHED_BUILD_PATHS }}
823823
key: ${{ env.BUILD_CACHE_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ sentry-node-serverless-*.zip
2121
jest/transformers/*.js
2222
# node tarballs
2323
packages/*/sentry-*.tgz
24+
.nxcache
2425

2526
# logs
2627
yarn-error.log

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.md
2+
.nxcache

nx.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build:transpile",
99
"build:types",
1010
"lint:eslint"
11-
]
11+
],
12+
"cacheDirectory": ".nxcache"
1213
}
1314
}
1415
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"circularDepCheck": "lerna run circularDepCheck",
1515
"clean": "run-p clean:build clean:caches",
1616
"clean:build": "lerna run clean",
17-
"clean:caches": "yarn rimraf eslintcache && yarn jest --clearCache",
17+
"clean:caches": "yarn rimraf eslintcache .nxcache && yarn jest --clearCache",
1818
"clean:deps": "lerna clean --yes && rm -rf node_modules && yarn",
1919
"clean:all": "run-p clean:build clean:caches clean:deps",
2020
"codecov": "codecov",

0 commit comments

Comments
 (0)