@@ -132,15 +132,6 @@ jobs:
132
132
yarn install --cwd example
133
133
yarn install
134
134
135
- - name : Cache turborepo
136
- uses : actions/cache@v3
137
- with :
138
- path : |
139
- ${{ env.work_dir }}/.turbo
140
- key : ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-${{ hashFiles(format('{0}/**/yarn.lock', env.work_dir)) }}
141
- restore-keys : |
142
- ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-
143
-
144
135
- name : Get build target
145
136
working-directory : ${{ env.work_dir }}
146
137
run : |
@@ -158,6 +149,31 @@ jobs:
158
149
fi
159
150
fi
160
151
152
+ - name : Cache turborepo
153
+ if : env.android_build == 1 || env.ios_build == 1
154
+ uses : actions/cache@v3
155
+ with :
156
+ path : |
157
+ ${{ env.work_dir }}/.turbo
158
+ key : ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-${{ hashFiles(format('{0}/**/yarn.lock', env.work_dir)) }}
159
+ restore-keys : |
160
+ ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-
161
+
162
+ - name : Check turborepo cache
163
+ if : env.android_build == 1 || env.ios_build == 1
164
+ working-directory : ${{ env.work_dir }}
165
+ run : |
166
+ TURBO_CACHE_STATUS_ANDROID=$(node -p "($(yarn --silent turbo run build:android --cache-dir=".turbo/cache" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
167
+ TURBO_CACHE_STATUS_IOS=$(node -p "($(yarn --silent turbo run build:ios --cache-dir=".turbo/cache" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
168
+
169
+ if [[ $TURBO_CACHE_STATUS_ANDROID == "HIT" ]]; then
170
+ echo "turbo_cache_hit_android=1" >> $GITHUB_ENV
171
+ fi
172
+
173
+ if [[ $TURBO_CACHE_STATUS_IOS == "HIT" ]]; then
174
+ echo "turbo_cache_hit_ios=1" >> $GITHUB_ENV
175
+ fi
176
+
161
177
- name : Lint library
162
178
working-directory : ${{ env.work_dir }}
163
179
run : |
@@ -185,19 +201,19 @@ jobs:
185
201
yarn example expo export:web
186
202
187
203
- name : Install JDK
188
- if : env.android_build == 1
204
+ if : env.android_build == 1 && env.turbo_cache_hit_android != 1
189
205
uses : actions/setup-java@v3
190
206
with :
191
207
distribution : ' zulu'
192
208
java-version : ' 11'
193
209
194
210
- name : Finalize Android SDK
195
- if : env.android_build == 1
211
+ if : env.android_build == 1 && env.turbo_cache_hit_android != 1
196
212
run : |
197
213
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
198
214
199
215
- name : Cache Gradle
200
- if : env.android_build == 1
216
+ if : env.android_build == 1 && env.turbo_cache_hit_android != 1
201
217
uses : actions/cache@v3
202
218
with :
203
219
path : |
@@ -212,7 +228,7 @@ jobs:
212
228
yarn turbo run build:android --cache-dir=".turbo/cache"
213
229
214
230
- name : Cache cocoapods
215
- if : env.ios_build == 1
231
+ if : env.ios_build == 1 && env.turbo_cache_hit_ios != 1
216
232
id : library-cocoapods-cache
217
233
uses : actions/cache@v3
218
234
with :
@@ -225,7 +241,7 @@ jobs:
225
241
${{ runner.os }}-library-cocoapods-
226
242
227
243
- name : Install cocoapods
228
- if : steps.library-cocoapods-cache.outputs.cache-hit != 'true' && env.ios_build == 1
244
+ if : env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true'
229
245
working-directory : ${{ env.work_dir }}
230
246
run : |
231
247
yarn example pods
0 commit comments