Skip to content

Commit

Permalink
test: improve caching in workflows
Browse files Browse the repository at this point in the history
I learned a lot about github caching while working on buildcache-action,
implementing better caching key usage here to implement the knowledge...
  • Loading branch information
mikehardy committed May 5, 2021
1 parent 0b62d5a commit 921bd4c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
restore-keys: ${{ runner.os }}-yarn
- name: Yarn Install
uses: nick-invision/retry@v2
with:
Expand Down Expand Up @@ -81,8 +80,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
restore-keys: ${{ runner.os }}-yarn
- name: Yarn Install
uses: nick-invision/retry@v2
with:
Expand Down Expand Up @@ -116,8 +114,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-with-website
restore-keys: |
${{ runner.os }}-yarn-
restore-keys: ${{ runner.os }}-yarn
- name: Yarn Install
uses: nick-invision/retry@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/tests_e2e_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v1
key: firebase-emulators-${{ github.run_id }}-v1
restore-key: firebase-emulators

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

- uses: actions/cache@v2
name: Gradle Cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-v1
restore-keys: ${{ runner.os }}-gradle

- name: Yarn Install
uses: nick-invision/retry@v2
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/tests_e2e_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
with:
fetch-depth: 50

- uses: mikehardy/buildcache-action@v1
name: Buildcache
with:
cache_key: ${{ runner.os }}-v1
upload_buildcache_log: true

- uses: actions/setup-node@v2
with:
node-version: 14
Expand Down Expand Up @@ -75,15 +81,15 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
restore-keys: ${{ runner.os }}-yarn-
restore-keys: ${{ runner.os }}-yarn

- uses: actions/cache@v2
name: Cache Pods
id: pods-cache
with:
path: tests/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}-v1
restore-keys: ${{ runner.os }}-pods-
restore-keys: ${{ runner.os }}-pods

- uses: actions/cache@v2
name: Detox Framework Cache
Expand Down Expand Up @@ -116,11 +122,6 @@ jobs:
max_attempts: 3
command: yarn tests:ios:pod:install

- uses: mikehardy/buildcache-action@v1
name: Buildcache
with:
key: ${{ runner.os }}-v1

- name: Build iOS App
run: |
export SKIP_BUNDLING=1
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tests_jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
restore-keys: ${{ runner.os }}-yarn
- name: Yarn Install
uses: nick-invision/retry@v2
with:
Expand Down

1 comment on commit 921bd4c

@vercel
Copy link

@vercel vercel bot commented on 921bd4c May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.