Skip to content

Commit 37cfe27

Browse files
committed
chore(ci): remove per-commit build artifact caching to reduce cache pressure
1 parent 2dc30ed commit 37cfe27

3 files changed

Lines changed: 37 additions & 60 deletions

File tree

.github/workflows/reusable-e2e.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,13 @@ jobs:
142142
env:
143143
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
144144

145-
- name: Restore ui/dist cache
146-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
147-
id: restore-ui-cache
148-
with:
149-
path: ./packages/ui/dist
150-
key: ${{ runner.os }}-ui-${{ inputs.commit }}
151-
152-
- name: Restore ${{ matrix.package }}/dist cache
153-
id: restore-package-cache
154-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
155-
with:
156-
path: ./packages/${{ matrix.package }}/dist
157-
key: ${{ runner.os }}-${{ matrix.package }}-${{ inputs.commit }}
158-
env:
159-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
160-
161145
- name: Install packages
162146
if: steps.restore-cache.outputs.cache-hit != 'true' || steps.restore-cypress-cache.outputs.cache-hit != 'true'
163147
uses: ./.github/actions/install-with-retries
164148
with:
165149
skip-cypress-binary: false
166150

167151
- name: Build @aws-amplify/ui package
168-
if: steps.restore-ui-cache.outputs.cache-hit != 'true'
169152
run: yarn ui build
170153

171154
- name: Build react-core package
@@ -177,7 +160,6 @@ jobs:
177160
run: yarn react-core-notifications build
178161

179162
- name: Build ${{ matrix.package }} package
180-
if: steps.restore-package-cache.outputs.cache-hit != 'true'
181163
run: yarn ${{ matrix.package }} build
182164

183165
- name: Build react-notifications package
Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Description: this is a reusable workflow that sets up cache for unit and e2e testss.
1+
# Description: this is a reusable workflow that sets up cache for unit and e2e tests.
2+
# It checks if caches exist and populates them if missing, so downstream jobs can restore them.
23

34
on:
45
workflow_call:
@@ -29,44 +30,51 @@ jobs:
2930
cache: 'yarn'
3031
env:
3132
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
32-
- name: Restore cypress runner from Cache
33-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
34-
id: restore-cypress-cache
33+
- name: Check if Cypress cache exists
34+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
35+
id: check-cypress-cache
3536
with:
3637
path: ~/.cache/Cypress
3738
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
38-
env:
39-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
40-
- name: Restore Puppeteer runner from Cache
41-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
42-
id: restore-puppeteer-cache
39+
lookup-only: true
40+
- name: Check if Puppeteer cache exists
41+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
42+
id: check-puppeteer-cache
4343
with:
4444
path: ~/.cache/puppeteer
4545
key: ${{ runner.os }}-puppeteer-${{ hashFiles('yarn.lock') }}
46-
env:
47-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
48-
- name: Restore node_modules from Cache
49-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
50-
id: restore-node-modules-cache
46+
lookup-only: true
47+
- name: Check if node_modules cache exists
48+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
49+
id: check-node-modules-cache
5150
with:
5251
path: |
5352
./node_modules
5453
**/node_modules
5554
key: ${{ runner.os }}-nodemodules-${{ hashFiles('yarn.lock') }}
56-
env:
57-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
55+
lookup-only: true
5856
- name: Install packages
59-
if: steps.restore-node-modules-cache.outputs.cache-hit != 'true'
57+
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
6058
uses: ./.github/actions/install-with-retries
6159
with:
62-
# only install binary if cypress cache missed
63-
skip-cypress-binary: ${{ steps.restore-cypress-cache.outputs.cache-hit }}
64-
- name: Restore packages/ui/dist from Cache
65-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
66-
id: restore-ui-cache
60+
skip-cypress-binary: ${{ steps.check-cypress-cache.outputs.cache-hit }}
61+
- name: Cache node_modules
62+
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
63+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
6764
with:
68-
path: ./packages/ui/dist
69-
key: ${{ runner.os }}-ui-${{ inputs.commit }}
70-
- name: Build ui package
71-
if: steps.restore-ui-cache.outputs.cache-hit != 'true'
72-
run: yarn ui build
65+
path: |
66+
./node_modules
67+
**/node_modules
68+
key: ${{ runner.os }}-nodemodules-${{ hashFiles('yarn.lock') }}
69+
- name: Cache Cypress
70+
if: steps.check-cypress-cache.outputs.cache-hit != 'true'
71+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
72+
with:
73+
path: ~/.cache/Cypress
74+
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
75+
- name: Cache Puppeteer
76+
if: steps.check-puppeteer-cache.outputs.cache-hit != 'true'
77+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
78+
with:
79+
path: ~/.cache/puppeteer
80+
key: ${{ runner.os }}-puppeteer-${{ hashFiles('yarn.lock') }}

.github/workflows/reusable-unit.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,14 @@ jobs:
6262
env:
6363
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
6464

65-
- name: Restore ui/dist cache
66-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
67-
id: restore-ui-cache
68-
with:
69-
path: ./packages/ui/dist
70-
key: ${{ runner.os }}-ui-${{ inputs.commit }}
71-
env:
72-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
73-
7465
- name: Install packages
7566
if: steps.restore-cache.outputs.cache-hit != 'true'
7667
uses: ./.github/actions/install-with-retries
7768
with:
7869
skip-cypress-binary: true # unit test doesn't need cypress
7970

8071
- name: Build ui package for downstream dependencies
81-
if: ${{ steps.restore-ui-cache.outputs.cache-hit != 'true' && matrix.package != 'ui' }}
72+
if: ${{ matrix.package != 'ui' }}
8273
run: yarn ui build
8374

8475
- name: Build react-core package
@@ -135,8 +126,4 @@ jobs:
135126
matrix.package == 'react-storage'
136127
run: yarn ${{ matrix.package }} size
137128

138-
- name: Cache ${{ matrix.package }}/dist
139-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 https://github.com/actions/cache/commit/1bd1e32a3bdc45362d1e726936510720a7c30a57
140-
with:
141-
path: ./packages/${{ matrix.package }}/dist
142-
key: ${{ runner.os }}-${{ matrix.package }}-${{ inputs.commit }}
129+

0 commit comments

Comments
 (0)