Skip to content

chore: always cache actions regardless of failure #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ runs:
with:
node-version-file: .nvmrc

- name: Cache dependencies
- name: Restore dependencies
id: yarn-cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
**/node_modules
Expand All @@ -25,3 +25,12 @@ runs:
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash

- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
26 changes: 22 additions & 4 deletions .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ jobs:
--example ${{ matrix.language == 'js' && 'expo' || 'vanilla' }} \
--no-local

- name: Cache dependencies of library
- name: Restore dependencies of library
id: library-yarn-cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
${{ env.work_dir }}/**/node_modules
Expand All @@ -107,6 +107,15 @@ jobs:
rm -f example/yarn.lock # Workaround for cached yarn.lock from older version
yarn install --no-immutable

- name: Cache dependencies of library
if: steps.library-yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
${{ env.work_dir }}/**/node_modules
${{ env.work_dir }}/yarn.lock
key: ${{ steps.library-yarn-cache.outputs.cache-primary-key }}

- name: Use local version of react-native-builder-bob
run: |
cd packages/react-native-builder-bob
Expand Down Expand Up @@ -215,10 +224,10 @@ jobs:
run: |
yarn turbo run build:android --cache-dir=".turbo"

- name: Cache cocoapods
- name: Restore cocoapods
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1
id: library-cocoapods-cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
${{ env.work_dir }}/**/ios/Pods
Expand All @@ -237,6 +246,15 @@ jobs:
cd example/ios
pod install

- name: Cache cocoapods
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
${{ env.work_dir }}/**/ios/Pods
${{ env.work_dir }}/**/ios/Podfile.lock
key: ${{ steps.library-cocoapods-cache.outputs.cache-primary-key }}

- name: Build example (iOS)
if: env.ios_build == 1
working-directory: ${{ env.work_dir }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ runs:
with:
node-version-file: .nvmrc

- name: Cache dependencies
- name: Restore dependencies
id: yarn-cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: |
**/node_modules
Expand All @@ -25,3 +25,12 @@ runs:
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash

- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
Expand All @@ -119,7 +119,7 @@ jobs:
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
Expand All @@ -134,10 +134,10 @@ jobs:
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Cache cocoapods
- name: Restore cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: |
**/ios/Pods
Expand All @@ -153,6 +153,14 @@ jobs:
env:
NO_FLIPPER: 1

- name: Cache cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
**/ios/Pods
key: ${{ steps.cocoapods-cache.outputs.cache-key }}

- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Expand Down
Loading