Skip to content

Commit ab64bed

Browse files
authored
chore(ci): add timeout to cache downloads (#2755)
* Add timeouts to cache * Remove unrelated file
1 parent ad1f9b6 commit ab64bed

File tree

4 files changed

+50
-20
lines changed

4 files changed

+50
-20
lines changed

.github/workflows/build-and-runtime-test.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ jobs:
4949
run: echo "::set-output name=version::$(amplify --version)"
5050
- name: Create or restore environments cache
5151
id: environments-cache
52-
uses: actions/cache@v2
52+
uses: actions/cache@v3
5353
with:
5454
path: canary/environments/**/aws-exports.js
5555
key: ${{ runner.os }}-canary-environments-${{ steps.cli-version.outputs.version }}-${{ hashFiles('canary/environments/**/amplify/**') }}
56+
env:
57+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
5658
- name: Pull down AWS environments
5759
if: steps.environments-cache.outputs.cache-hit != 'true'
5860
run: yarn pull
@@ -66,11 +68,13 @@ jobs:
6668
# This steps attempts to restore cypress runner. It will not create any new
6769
# cache entries however, because cypress runner isn't available yet.
6870
- name: Restore cypress runner from Cache
69-
uses: actions/cache@v2
71+
uses: actions/cache@v3
7072
id: restore-cypress-cache
7173
with:
7274
path: ~/.cache/Cypress
7375
key: ${{ runner.os }}-canary-cypress-${{ hashFiles('canary/e2e/yarn.lock') }}
76+
env:
77+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
7478
- name: Install e2e packages
7579
uses: ./.github/actions/install-with-retries
7680
with:
@@ -83,10 +87,12 @@ jobs:
8387
# step, so we go ahead and update the cache entry.
8488
- name: Cache cypress runner
8589
if: steps.restore-cypress-cache.outputs.cache-hit != 'true'
86-
uses: actions/cache@v2
90+
uses: actions/cache@v3
8791
with:
8892
path: ~/.cache/Cypress
8993
key: ${{ runner.os }}-canary-cypress-${{ hashFiles('canary/e2e/yarn.lock') }}
94+
env:
95+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
9096
- name: Start ${{ matrix.example }} example
9197
run: yarn start & npx wait-on -c waitOnConfig.json -t 20000 http-get://localhost:3000
9298
working-directory: ./canary/apps/${{ matrix.path }}

.github/workflows/publish-latest.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ jobs:
5454
run: echo "::set-output name=version::$(amplify --version)"
5555
- name: Create or restore environments cache
5656
id: environments-cache
57-
uses: actions/cache@v2
57+
uses: actions/cache@v3
5858
with:
5959
path: canary/environments/**/aws-exports.js
6060
key: ${{ runner.os }}-canary-environments-${{ steps.cli-version.outputs.version }}-${{ hashFiles('canary/environments/**/amplify/**') }}
61+
env:
62+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
6163
- name: Pull down AWS environments
6264
if: steps.environments-cache.outputs.cache-hit != 'true'
6365
run: yarn pull

.github/workflows/publish-next.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ jobs:
6363
cache: 'yarn'
6464

6565
- name: Restore cypress runner Cache
66-
uses: actions/cache@v2
66+
uses: actions/cache@v3
6767
id: restore-cypress-cache
6868
with:
6969
path: ~/.cache/Cypress
7070
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
71+
env:
72+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
7173

7274
- name: Install packages
7375
run: yarn install
@@ -130,10 +132,12 @@ jobs:
130132
run: echo "::set-output name=version::$(amplify --version)"
131133
- name: Create or restore environments cache
132134
id: environments-cache
133-
uses: actions/cache@v2
135+
uses: actions/cache@v3
134136
with:
135137
path: canary/environments/**/aws-exports.js
136138
key: ${{ runner.os }}-canary-environments-${{ steps.cli-version.outputs.version }}-${{ hashFiles('canary/environments/**/amplify/**') }}
139+
env:
140+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
137141
- name: Pull down AWS environments
138142
if: steps.environments-cache.outputs.cache-hit != 'true'
139143
run: yarn pull

.github/workflows/reusable-e2e.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ jobs:
6565
node-version: lts/*
6666
cache: 'yarn'
6767
- name: Restore cypress runner from Cache
68-
uses: actions/cache@v2
68+
uses: actions/cache@v3
6969
id: restore-cypress-cache
7070
with:
7171
path: ~/.cache/Cypress
7272
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
73+
env:
74+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
7375
- name: Install packages
7476
uses: ./.github/actions/install-with-retries
7577
with:
@@ -80,17 +82,17 @@ jobs:
8082
- name: Cache cypress runner
8183
# create new cypress cache entry only if cypress cache missed and we installed a new one.
8284
if: steps.restore-cypress-cache.outputs.cache-hit != 'true'
83-
uses: actions/cache@v2
85+
uses: actions/cache@v3
8486
with:
8587
path: ~/.cache/Cypress
8688
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
8789
- name: Cache packages/ui/dist
88-
uses: actions/cache@v2
90+
uses: actions/cache@v3
8991
with:
9092
path: ./packages/ui/dist
9193
key: ${{ runner.os }}-ui-${{ inputs.commit }}
9294
- name: Cache node_modules
93-
uses: actions/cache@v2
95+
uses: actions/cache@v3
9496
with:
9597
path: |
9698
./node_modules
@@ -127,20 +129,24 @@ jobs:
127129
cache: 'yarn'
128130

129131
- name: Restore node_modules cache
130-
uses: actions/cache@v2
132+
uses: actions/cache@v3
131133
id: restore-cache
132134
with:
133135
path: |
134136
./node_modules
135137
**/node_modules
136138
key: ${{ runner.os }}-nodemodules-${{ inputs.commit }}
139+
env:
140+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
137141

138142
- name: Restore ui/dist cache
139-
uses: actions/cache@v2
143+
uses: actions/cache@v3
140144
id: restore-ui-cache
141145
with:
142146
path: ./packages/ui/dist
143147
key: ${{ runner.os }}-ui-${{ inputs.commit }}
148+
env:
149+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
144150

145151
- name: Install packages
146152
if: steps.restore-cache.outputs.cache-hit != 'true'
@@ -163,7 +169,7 @@ jobs:
163169
run: yarn react size
164170

165171
- name: Cache ${{ matrix.package }}/dist
166-
uses: actions/cache@v2
172+
uses: actions/cache@v3
167173
with:
168174
path: ./packages/${{ matrix.package }}/dist
169175
key: ${{ runner.os }}-${{ matrix.package }}-${{ inputs.commit }}
@@ -212,10 +218,12 @@ jobs:
212218
persist-credentials: false
213219

214220
- name: Next.js Cache
215-
uses: actions/cache@v2
221+
uses: actions/cache@v3
216222
with:
217223
path: ${{ github.workspace }}/.next/cache
218224
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}
225+
env:
226+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
219227

220228
- name: Setup Node.js LTS
221229
uses: actions/setup-node@v3
@@ -224,34 +232,40 @@ jobs:
224232
cache: 'yarn'
225233

226234
- name: Restore cypress runner Cache
227-
uses: actions/cache@v2
235+
uses: actions/cache@v3
228236
id: restore-cypress-cache
229237
with:
230238
path: ~/.cache/Cypress
231239
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
240+
env:
241+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
232242

233243
- name: Restore node_modules cache
234-
uses: actions/cache@v2
244+
uses: actions/cache@v3
235245
id: restore-cache
236246
with:
237247
path: |
238248
./node_modules
239249
**/node_modules
240250
key: ${{ runner.os }}-nodemodules-${{ inputs.commit }}
251+
env:
252+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
241253

242254
- name: Restore ui/dist cache
243-
uses: actions/cache@v2
255+
uses: actions/cache@v3
244256
id: restore-ui-cache
245257
with:
246258
path: ./packages/ui/dist
247259
key: ${{ runner.os }}-ui-${{ inputs.commit }}
248260

249261
- name: Restore ${{ matrix.package }}/dist cache
250262
id: restore-package-cache
251-
uses: actions/cache@v2
263+
uses: actions/cache@v3
252264
with:
253265
path: ./packages/${{ matrix.package }}/dist
254266
key: ${{ runner.os }}-${{ matrix.package }}-${{ inputs.commit }}
267+
env:
268+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
255269

256270
- name: Install packages
257271
if: steps.restore-cache.outputs.cache-hit != 'true' || steps.restore-cypress-cache.outputs.cache-hit != 'true'
@@ -278,10 +292,12 @@ jobs:
278292

279293
- name: Create or restore environments cache
280294
id: environments-cache
281-
uses: actions/cache@v2
295+
uses: actions/cache@v3
282296
with:
283297
path: environments/**/aws-exports.js
284298
key: ${{ runner.os }}-environments-${{ steps.cli-version.outputs.version }}-${{ hashFiles('environments/**/amplify/**') }}
299+
env:
300+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
285301

286302
# Pulling phone environments from original account,
287303
- name: Pull down Auth Phone AWS environments, on cache miss
@@ -352,11 +368,13 @@ jobs:
352368
cache: 'yarn'
353369

354370
- name: Restore cypress runner Cache
355-
uses: actions/cache@v2
371+
uses: actions/cache@v3
356372
id: restore-cypress-cache
357373
with:
358374
path: ~/.cache/Cypress
359375
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
376+
env:
377+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
360378

361379
- name: Install packages
362380
run: yarn install

0 commit comments

Comments
 (0)