Skip to content

Commit 921bd4c

Browse files
committed
test: improve caching in workflows
I learned a lot about github caching while working on buildcache-action, implementing better caching key usage here to implement the knowledge...
1 parent 0b62d5a commit 921bd4c

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

.github/workflows/linting.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232
with:
3333
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
3434
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
35-
restore-keys: |
36-
${{ runner.os }}-yarn-
35+
restore-keys: ${{ runner.os }}-yarn
3736
- name: Yarn Install
3837
uses: nick-invision/retry@v2
3938
with:
@@ -81,8 +80,7 @@ jobs:
8180
with:
8281
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
8382
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
84-
restore-keys: |
85-
${{ runner.os }}-yarn-
83+
restore-keys: ${{ runner.os }}-yarn
8684
- name: Yarn Install
8785
uses: nick-invision/retry@v2
8886
with:
@@ -116,8 +114,7 @@ jobs:
116114
with:
117115
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
118116
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-with-website
119-
restore-keys: |
120-
${{ runner.os }}-yarn-
117+
restore-keys: ${{ runner.os }}-yarn
121118
- name: Yarn Install
122119
uses: nick-invision/retry@v2
123120
with:

.github/workflows/tests_e2e_android.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ jobs:
5252
uses: actions/cache@v2
5353
with:
5454
path: ~/.cache/firebase/emulators
55-
key: firebase-emulators-v1
55+
key: firebase-emulators-${{ github.run_id }}-v1
56+
restore-key: firebase-emulators
5657

5758
- name: Start Firestore Emulator
5859
run: yarn tests:emulator:start-ci
@@ -67,12 +68,14 @@ jobs:
6768
with:
6869
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
6970
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
71+
restore-keys: ${{ runner.os }}-yarn
7072

7173
- uses: actions/cache@v2
7274
name: Gradle Cache
7375
with:
7476
path: ~/.gradle/caches
7577
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-v1
78+
restore-keys: ${{ runner.os }}-gradle
7679

7780
- name: Yarn Install
7881
uses: nick-invision/retry@v2

.github/workflows/tests_e2e_ios.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636
with:
3737
fetch-depth: 50
3838

39+
- uses: mikehardy/buildcache-action@v1
40+
name: Buildcache
41+
with:
42+
cache_key: ${{ runner.os }}-v1
43+
upload_buildcache_log: true
44+
3945
- uses: actions/setup-node@v2
4046
with:
4147
node-version: 14
@@ -75,15 +81,15 @@ jobs:
7581
with:
7682
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
7783
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
78-
restore-keys: ${{ runner.os }}-yarn-
84+
restore-keys: ${{ runner.os }}-yarn
7985

8086
- uses: actions/cache@v2
8187
name: Cache Pods
8288
id: pods-cache
8389
with:
8490
path: tests/ios/Pods
8591
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}-v1
86-
restore-keys: ${{ runner.os }}-pods-
92+
restore-keys: ${{ runner.os }}-pods
8793

8894
- uses: actions/cache@v2
8995
name: Detox Framework Cache
@@ -116,11 +122,6 @@ jobs:
116122
max_attempts: 3
117123
command: yarn tests:ios:pod:install
118124

119-
- uses: mikehardy/buildcache-action@v1
120-
name: Buildcache
121-
with:
122-
key: ${{ runner.os }}-v1
123-
124125
- name: Build iOS App
125126
run: |
126127
export SKIP_BUNDLING=1

.github/workflows/tests_jest.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
with:
4545
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
4646
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
47-
restore-keys: |
48-
${{ runner.os }}-yarn-
47+
restore-keys: ${{ runner.os }}-yarn
4948
- name: Yarn Install
5049
uses: nick-invision/retry@v2
5150
with:

0 commit comments

Comments
 (0)