91
91
run : |
92
92
yarn workspace create-react-native-library prepare
93
93
94
- - name : Configure environment
94
+ - name : Get working directory
95
95
run : |
96
- echo "work_dir=tmp-${{ matrix.type }}-${{ matrix.language }}" >> $GITHUB_ENV
97
-
98
- # Build Android for only some matrices to skip redundant builds
99
- if [[ ${{ matrix.os }} == ubuntu ]]; then
100
- if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
101
- echo "build_android=1" >> $GITHUB_ENV
102
- fi
103
- fi
104
-
105
- # Build iOS for only some matrices to skip redundant builds
106
- if [[ ${{ matrix.os }} == macos ]]; then
107
- if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
108
- echo "build_ios=1" >> $GITHUB_ENV
109
- fi
110
- fi
96
+ echo "work_dir=${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }}" >> $GITHUB_ENV
111
97
112
98
- name : Create library
113
99
run : |
@@ -120,6 +106,7 @@ jobs:
120
106
--repo-url https://test.test \
121
107
--type ${{ matrix.type }} \
122
108
--languages ${{ matrix.language }} \
109
+ --react-native-version 0.71.0-rc.3 \
123
110
--turborepo
124
111
125
112
- name : Cache dependencies of library
@@ -149,68 +136,71 @@ jobs:
149
136
restore-keys : |
150
137
${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-
151
138
139
+ - name : Get build target
140
+ working-directory : ${{ env.work_dir }}
141
+ run : |
142
+ # Build Android for only some matrices to skip redundant builds
143
+ if [[ ${{ matrix.os }} == ubuntu ]]; then
144
+ if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
145
+ echo "android_build=1" >> $GITHUB_ENV
146
+ fi
147
+ fi
148
+
149
+ # Build iOS for only some matrices to skip redundant builds
150
+ if [[ ${{ matrix.os }} == macos ]]; then
151
+ if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
152
+ echo "ios_build=1" >> $GITHUB_ENV
153
+ fi
154
+ fi
155
+
152
156
- name : Lint library
153
- if : matrix.os == 'ubuntu'
154
157
working-directory : ${{ env.work_dir }}
155
158
run : |
156
159
yarn lint
157
160
158
161
- name : Typecheck library
159
- if : matrix.os == 'ubuntu'
160
162
working-directory : ${{ env.work_dir }}
161
163
run : |
162
- yarn typescript
164
+ yarn typecheck
163
165
164
166
- name : Test library
165
- if : matrix.os == 'ubuntu'
166
167
working-directory : ${{ env.work_dir }}
167
168
run : |
168
169
yarn test
169
170
170
171
- name : Install JDK
171
- if : env.build_android == 1
172
+ if : env.android_build == 1
172
173
uses : actions/setup-java@v3
173
174
with :
174
175
distribution : ' zulu'
175
176
java-version : ' 11'
176
177
177
- - name : Install NDK
178
- if : env.build_android == 1
179
- uses : nttld/setup-ndk@v1
180
- with :
181
- ndk-version : r21d
182
- local-cache : true
183
-
184
- - name : Finalize Android NDK & SDK
185
- if : env.build_android == 1
178
+ - name : Finalize Android SDK
179
+ if : env.android_build == 1
186
180
run : |
187
- echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV
188
181
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
189
182
190
183
- name : Cache Gradle
191
- if : env.build_android == 1
184
+ if : env.android_build == 1
192
185
uses : actions/cache@v3
193
186
with :
194
187
path : |
195
188
~/.gradle/wrapper
196
189
~/.gradle/caches
197
190
key : ${{ runner.os }}-gradle-${{ hashFiles(format('{0}/example/android/gradle/wrapper/gradle-wrapper.properties', env.work_dir)) }}
198
191
199
- - name : Cache android libraries
200
- if : env.build_android == 1
201
- uses : actions/cache@v3
202
- with :
203
- path : ${{ env.work_dir }}/example/android/app/build/react-ndk
204
- key : ${{ runner.os }}-react-ndk-${{ hashFiles(format('{0}/example/node_modules/react-native/package.json', env.work_dir)) }}
205
-
206
192
- name : Build example (Android)
207
- if : env.build_android == 1
193
+ if : env.android_build == 1
208
194
working-directory : ${{ env.work_dir }}
209
195
run : |
210
196
yarn turbo run build:android --cache-dir=".turbo/cache"
211
197
198
+ - name : Cache iOS build
199
+ if : env.ios_build == 1
200
+ uses : mikehardy/buildcache-action@v1
201
+
212
202
- name : Cache cocoapods
213
- if : env.build_ios == 1
203
+ if : env.ios_build == 1
214
204
id : library-cocoapods-cache
215
205
uses : actions/cache@v3
216
206
with :
@@ -222,15 +212,15 @@ jobs:
222
212
${{ runner.os }}-library-cocoapods-${{ env.work_dir }}-
223
213
224
214
- name : Install cocoapods
225
- if : steps.library-cocoapods-cache.outputs.cache-hit != 'true' && env.build_ios == 1
215
+ if : steps.library-cocoapods-cache.outputs.cache-hit != 'true' && env.ios_build == 1
226
216
working-directory : ${{ env.work_dir }}
227
217
run : |
228
218
yarn example pods
229
219
env :
230
220
NO_FLIPPER : 1
231
221
232
222
- name : Cache iOS build artifacts
233
- if : env.build_ios == 1
223
+ if : env.ios_build == 1
234
224
uses : actions/cache@v3
235
225
with :
236
226
path : |
@@ -240,7 +230,7 @@ jobs:
240
230
${{ runner.os }}-library-xcode-derived-data-${{ env.work_dir }}-
241
231
242
232
- name : Build example (iOS)
243
- if : env.build_ios == 1
233
+ if : env.ios_build == 1
244
234
working-directory : ${{ env.work_dir }}
245
235
run : |
246
236
yarn turbo run build:ios --cache-dir=".turbo/cache"
0 commit comments