Skip to content

Commit 5cbb82b

Browse files
committed
Add build steps for both architectures
1 parent 59bc5cf commit 5cbb82b

File tree

1 file changed

+184
-32
lines changed

1 file changed

+184
-32
lines changed

.github/workflows/test.yml

+184-32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: CI
2+
23
on: [push, pull_request]
34

45
concurrency:
@@ -13,62 +14,147 @@ jobs:
1314
- uses: actions/[email protected]
1415
with:
1516
node-version: 18.x
16-
- name: Get yarn cache directory path
17-
id: yarn-cache-dir-path
18-
run: echo "::set-output name=dir::$(yarn cache dir)"
19-
- uses: actions/cache@v4
20-
id: yarn-cache
17+
18+
# Cache Yarn dependencies
19+
- name: Cache Yarn dependencies
20+
uses: actions/cache@v4
2121
with:
22-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
22+
path: ${{ github.workspace }}/node_modules
2323
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2424
restore-keys: |
2525
${{ runner.os }}-yarn-
26-
- name: Run test
26+
27+
# Install dependencies and run lint
28+
- name: Install dependencies and run lint
2729
run: |
2830
yarn
2931
yarn lint
3032
31-
build-ios:
32-
runs-on: macos-latest
33+
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' path/to/your/file.json
3334
35+
build-ios-old-arch:
36+
runs-on: macos-latest
3437
steps:
3538
# Checkout the code
3639
- name: Checkout the code
3740
uses: actions/checkout@v4
3841

39-
# Set up Node.js environment
42+
# Disable new architecture in app config
43+
- name: Disable New Architecture in JSON
44+
working-directory: apps/external-display-example
45+
run: |
46+
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json
47+
48+
# Set up Node.js
4049
- name: Set up Node.js
4150
uses: actions/[email protected]
4251
with:
4352
node-version: 18.x
4453

45-
# Cache Yarn dependencies to speed up the build
46-
- name: Get yarn cache directory path
47-
id: yarn-cache-dir-path
48-
run: echo "::set-output name=dir::$(yarn cache dir)"
49-
50-
- uses: actions/cache@v4
51-
id: yarn-cache
54+
# Cache Yarn dependencies
55+
- name: Cache Yarn dependencies
56+
uses: actions/cache@v4
5257
with:
53-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
58+
path: ${{ github.workspace }}/node_modules
5459
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
5560
restore-keys: |
5661
${{ runner.os }}-yarn-
5762
63+
# Cache CocoaPods dependencies
64+
- name: Cache CocoaPods
65+
uses: actions/cache@v4
66+
with:
67+
path: |
68+
apps/external-display-example/ios/Pods
69+
apps/external-display-example/ios/Podfile.lock
70+
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
71+
restore-keys: |
72+
${{ runner.os }}-pods-
73+
5874
# Install dependencies
5975
- name: Install dependencies
6076
run: yarn
6177

6278
# Prebuild the iOS folder for Expo
6379
- name: Prebuild iOS with Expo
6480
working-directory: apps/external-display-example
81+
run: yarn expo prebuild --platform ios
82+
83+
# Install xcpretty for better build output
84+
- name: Install xcpretty
85+
run: gem install xcpretty
86+
87+
# Cache Xcode derived data
88+
- name: Cache Xcode Derived Data
89+
uses: actions/cache@v4
90+
with:
91+
path: apps/external-display-example/ios/build
92+
key: build-${{ github.sha }}
93+
94+
# Build the iOS app using Xcode (with xcpretty)
95+
- name: Build iOS App (Debug) with xcpretty
96+
working-directory: apps/external-display-example/ios
6597
run: |
66-
yarn expo prebuild --platform ios
98+
set -o pipefail && xcodebuild \
99+
-workspace externaldisplayexample.xcworkspace \
100+
-scheme externaldisplayexample \
101+
-configuration Debug \
102+
-sdk iphonesimulator \
103+
-derivedDataPath build | xcpretty
104+
105+
build-ios-new-arch:
106+
runs-on: macos-latest
107+
steps:
108+
# Checkout the code
109+
- name: Checkout the code
110+
uses: actions/checkout@v4
111+
112+
# Set up Node.js
113+
- name: Set up Node.js
114+
uses: actions/[email protected]
115+
with:
116+
node-version: 18.x
117+
118+
# Cache Yarn dependencies
119+
- name: Cache Yarn dependencies
120+
uses: actions/cache@v4
121+
with:
122+
path: ${{ github.workspace }}/node_modules
123+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
124+
restore-keys: |
125+
${{ runner.os }}-yarn-
126+
127+
# Cache CocoaPods dependencies
128+
- name: Cache CocoaPods
129+
uses: actions/cache@v4
130+
with:
131+
path: |
132+
apps/external-display-example/ios/Pods
133+
apps/external-display-example/ios/Podfile.lock
134+
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
135+
restore-keys: |
136+
${{ runner.os }}-pods-
137+
138+
# Install dependencies
139+
- name: Install dependencies
140+
run: yarn
141+
142+
# Prebuild the iOS folder for Expo
143+
- name: Prebuild iOS with Expo
144+
working-directory: apps/external-display-example
145+
run: yarn expo prebuild --platform ios
67146

68147
# Install xcpretty for better build output
69148
- name: Install xcpretty
70149
run: gem install xcpretty
71150

151+
# Cache Xcode derived data
152+
- name: Cache Xcode Derived Data
153+
uses: actions/cache@v4
154+
with:
155+
path: apps/external-display-example/ios/build
156+
key: build-${{ github.sha }}
157+
72158
# Build the iOS app using Xcode (with xcpretty)
73159
- name: Build iOS App (Debug) with xcpretty
74160
working-directory: apps/external-display-example/ios
@@ -80,15 +166,20 @@ jobs:
80166
-sdk iphonesimulator \
81167
-derivedDataPath build | xcpretty
82168
83-
build-android:
169+
build-android-old-arch:
84170
runs-on: ubuntu-latest
85-
86171
steps:
87172
# Checkout the code
88173
- name: Checkout the code
89174
uses: actions/checkout@v4
175+
176+
# Disable new architecture in app config
177+
- name: Disable New Architecture in JSON
178+
working-directory: apps/external-display-example
179+
run: |
180+
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json
90181
91-
# Set up Node.js environment
182+
# Set up Node.js
92183
- name: Set up Node.js
93184
uses: actions/[email protected]
94185
with:
@@ -101,30 +192,91 @@ jobs:
101192
distribution: 'temurin'
102193
java-version: '17'
103194

104-
# Cache Yarn dependencies to speed up the build
105-
- name: Get yarn cache directory path
106-
id: yarn-cache-dir-path
107-
run: echo "::set-output name=dir::$(yarn cache dir)"
195+
# Cache Yarn dependencies
196+
- name: Cache Yarn dependencies
197+
uses: actions/cache@v4
198+
with:
199+
path: ${{ github.workspace }}/node_modules
200+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
201+
restore-keys: |
202+
${{ runner.os }}-yarn-
108203
109-
- uses: actions/cache@v4
110-
id: yarn-cache
204+
# Cache Gradle dependencies
205+
- name: Cache Gradle
206+
uses: actions/cache@v4
111207
with:
112-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
208+
path: |
209+
~/.gradle/caches
210+
~/.gradle/wrapper
211+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
212+
restore-keys: |
213+
gradle-${{ runner.os }}-
214+
215+
# Install dependencies
216+
- name: Install dependencies
217+
run: yarn
218+
219+
# Prebuild the Android folder for Expo
220+
- name: Prebuild Android with Expo
221+
working-directory: apps/external-display-example
222+
run: yarn expo prebuild --platform android
223+
224+
# Build the APK using Gradle (without running on a device)
225+
- name: Build Android APK
226+
working-directory: apps/external-display-example/android
227+
run: ./gradlew assembleDebug
228+
229+
230+
build-android-new-arch:
231+
runs-on: ubuntu-latest
232+
steps:
233+
# Checkout the code
234+
- name: Checkout the code
235+
uses: actions/checkout@v4
236+
237+
# Set up Node.js
238+
- name: Set up Node.js
239+
uses: actions/[email protected]
240+
with:
241+
node-version: 18.x
242+
243+
# Install Java 17
244+
- name: Set up Java 17
245+
uses: actions/setup-java@v4
246+
with:
247+
distribution: 'temurin'
248+
java-version: '17'
249+
250+
# Cache Yarn dependencies
251+
- name: Cache Yarn dependencies
252+
uses: actions/cache@v4
253+
with:
254+
path: ${{ github.workspace }}/node_modules
113255
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
114256
restore-keys: |
115257
${{ runner.os }}-yarn-
116258
259+
# Cache Gradle dependencies
260+
- name: Cache Gradle
261+
uses: actions/cache@v4
262+
with:
263+
path: |
264+
~/.gradle/caches
265+
~/.gradle/wrapper
266+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
267+
restore-keys: |
268+
gradle-${{ runner.os }}-
269+
117270
# Install dependencies
118271
- name: Install dependencies
119272
run: yarn
120273

121274
# Prebuild the Android folder for Expo
122275
- name: Prebuild Android with Expo
123276
working-directory: apps/external-display-example
124-
run: |
125-
yarn expo prebuild --platform android
277+
run: yarn expo prebuild --platform android
126278

127-
# Build the APK without running on a device
279+
# Build the APK using Gradle (without running on a device)
128280
- name: Build Android APK
129281
working-directory: apps/external-display-example/android
130282
run: ./gradlew assembleDebug

0 commit comments

Comments
 (0)