From b8f386959a113d2a8128bb6a30ccf97c5cccee76 Mon Sep 17 00:00:00 2001 From: Russell Wheatley Date: Wed, 11 Sep 2024 11:52:08 +0100 Subject: [PATCH] test: update caching strategies for github actions (#13312) --- .github/workflows/android.yaml | 6 ++++-- .github/workflows/ios.yaml | 10 ++++++---- .github/workflows/macos.yaml | 10 ++++++---- .github/workflows/web.yaml | 12 +++++++++--- .github/workflows/windows.yaml | 4 ++++ 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index ca7cf4c2e93c..9ee6012c9c56 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -45,12 +45,14 @@ jobs: uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false @@ -76,7 +78,7 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-ubuntu + key: avd-${{ runner.os }} - name: Start AVD then run E2E tests uses: reactivecircus/android-emulator-runner@v2 with: diff --git a/.github/workflows/ios.yaml b/.github/workflows/ios.yaml index 1c9c96e44f28..a34593ab0fb4 100644 --- a/.github/workflows/ios.yaml +++ b/.github/workflows/ios.yaml @@ -44,25 +44,27 @@ jobs: - uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 name: Xcode Compile Cache with: - key: ${{ runner.os }}-ios-v3 + key: xcode-cache-${{ runner.os }} max-size: 700M - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 name: Pods Cache id: pods-cache with: path: tests/ios/Pods - key: ${{ runner.os }}-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }} - restore-keys: ${{ runner.os }}-ios-pods-v2 + key: pods-v3-${{ runner.os }}-${{ hashFiles('tests/ios/Podfile.lock') }} + restore-keys: pods-v3-${{ runner.os }} - name: Firebase Emulator Cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index ad4bc5697963..3f4029911165 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -44,25 +44,27 @@ jobs: - uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 name: Xcode Compile Cache with: - key: ${{ runner.os }}-macos-v2 + key: xcode-cache-${{ runner.os }} max-size: 700M - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 name: Pods Cache id: pods-cache with: path: tests/macos/Pods - key: ${{ runner.os }}-pods-v2-${{ hashFiles('tests/macos/Podfile.lock') }} - restore-keys: ${{ runner.os }}-macos-pods-v1 + key: pods-v3-${{ runner.os }}-${{ hashFiles('tests/macos/Podfile.lock') }} + restore-keys: pods-v3-${{ runner.os }} - name: Cache Firebase Emulator uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml index 6956ff6f4405..705acd7c75b5 100644 --- a/.github/workflows/web.yaml +++ b/.github/workflows/web.yaml @@ -45,6 +45,8 @@ jobs: with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false @@ -57,7 +59,7 @@ jobs: uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - name: Start Firebase Emulator run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh @@ -95,6 +97,8 @@ jobs: with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false @@ -107,7 +111,7 @@ jobs: uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - name: Start Firebase Emulator run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh @@ -150,6 +154,8 @@ jobs: with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false @@ -162,7 +168,7 @@ jobs: uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: ~/.cache/firebase/emulators - key: firebase-emulators-v3-${{ github.run_id }} + key: firebase-emulators-v3-${{ runner.os }} restore-keys: firebase-emulators-v3 - name: Start Firebase Emulator run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index cd962e44d438..550241fd120b 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -40,6 +40,8 @@ jobs: with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false @@ -70,6 +72,8 @@ jobs: with: channel: 'stable' cache: true + cache-key: flutter-${{ runner.os }} + pub-cache-key: pub-${{ runner.os }} - uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 with: run-bootstrap: false