@@ -14,6 +14,10 @@ permissions:
1414 contents : read
1515 pull-requests : read
1616
17+ env :
18+ NX_NO_CLOUD : true
19+ NX_CACHE_FILES : " modules/*/src/**/*.ts,modules/*/src/**/*.js,modules/*/*.json"
20+
1721jobs :
1822 unit-test :
1923 runs-on : ubuntu-latest
@@ -63,16 +67,31 @@ jobs:
6367 - name : Check In-Repo Package Versions
6468 run : yarn run check-versions
6569
70+ - name : restore nx cache
71+ id : nx-cache
72+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
73+ if : " !contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')"
74+ with :
75+ path : |
76+ .nx/cache
77+ modules/*/dist
78+ key : ${{ runner.os }}-nx-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
79+ restore-keys : |
80+ ${{ runner.os }}-nx-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}-
81+ ${{ runner.os }}-nx-${{ matrix.node-version }}-
82+
6683 - name : build packages
6784 env :
6885 # Workaround for https://github.com/nodejs/node/issues/51555
6986 DISABLE_V8_COMPILE_CACHE : ' 1'
87+ NX_SKIP_NX_CACHE : ${{ contains(github.event.pull_request.labels.*.name, 'SKIP_CACHE') && 'true' || '' }}
7088 run : yarn run postinstall
7189
7290 - name : Unit Test
7391 run : yarn run unit-test-changed
7492 env :
7593 BITGOJS_TEST_PASSWORD : ${{ secrets.BITGOJS_TEST_PASSWORD }}
94+ NX_SKIP_NX_CACHE : ${{ contains(github.event.pull_request.labels.*.name, 'SKIP_CACHE') && 'true' || '' }}
7695
7796 # - name: Upload Code Coverage
7897 # run: |
@@ -158,10 +177,24 @@ jobs:
158177 if : steps.lerna-cache.outputs.cache-hit != 'true'
159178 run : yarn install --with-frozen-lockfile --ignore-scripts
160179
180+ - name : restore nx cache
181+ id : nx-cache
182+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
183+ if : " !contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')"
184+ with :
185+ path : |
186+ .nx/cache
187+ modules/*/dist
188+ key : ${{ runner.os }}-nx-license-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
189+ restore-keys : |
190+ ${{ runner.os }}-nx-license-${{ hashFiles('yarn.lock') }}-
191+ ${{ runner.os }}-nx-license-
192+
161193 - name : build packages
162194 env :
163195 # Workaround for https://github.com/nodejs/node/issues/51555
164196 DISABLE_V8_COMPILE_CACHE : ' 1'
197+ NX_SKIP_NX_CACHE : ${{ contains(github.event.pull_request.labels.*.name, 'SKIP_CACHE') && 'true' || '' }}
165198 run : yarn run postinstall
166199
167200 - name : Run Fossa Analysis
@@ -251,6 +284,19 @@ jobs:
251284 if : steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
252285 run : yarn install --with-frozen-lockfile
253286
287+ - name : restore nx cache
288+ id : nx-cache
289+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
290+ if : " !contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')"
291+ with :
292+ path : |
293+ .nx/cache
294+ modules/*/dist
295+ key : ${{ runner.os }}-nx-browser-${{ hashFiles('yarn.lock') }}-${{ hashFiles(env.NX_CACHE_FILES) }}
296+ restore-keys : |
297+ ${{ runner.os }}-nx-browser-${{ hashFiles('yarn.lock') }}-
298+ ${{ runner.os }}-nx-browser-
299+
254300 - name : build packages
255301 if : steps.lerna-cache.outputs.cache-hit == 'true'
256302 env :
@@ -262,6 +308,7 @@ jobs:
262308 run : yarn run browser-tests
263309 env :
264310 BITGOJS_TEST_PASSWORD : ${{ secrets.BITGOJS_TEST_PASSWORD }}
311+ NX_SKIP_NX_CACHE : ${{ contains(github.event.pull_request.labels.*.name, 'SKIP_CACHE') && 'true' || '' }}
265312
266313 docker-build :
267314 runs-on : ubuntu-latest
0 commit comments