Skip to content

Commit e3e1c6f

Browse files
committed
Fix iOS build on CI
1 parent 643c8b6 commit e3e1c6f

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

.github/actions/build-app/action.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,26 @@ inputs:
2727
description: 'Platform (example: android or ios))'
2828
required: true
2929

30+
node-version:
31+
description: 'The Node.js version to set up'
32+
required: false
33+
34+
java-version:
35+
description: 'The Java version to set up'
36+
required: false
37+
3038

3139
runs:
3240
using: 'composite'
3341
steps:
3442
- uses: ./.github/actions/lock-nodejs-ver
43+
with:
44+
node-version: ${{ inputs.node-version }}
3545

3646
- uses: ./.github/actions/lock-java-ver
3747
if: ${{ inputs.platform == 'android' }}
48+
with:
49+
java-version: ${{ inputs.java-version }}
3850

3951
- uses: ./.github/actions/lock-ruby-ver
4052
if: ${{ inputs.platform == 'ios' }}
@@ -78,13 +90,25 @@ runs:
7890
if [[ '${{ inputs.platform }}' == 'ios' ]]; then
7991
brew install xcbeautify
8092
93+
94+
# Disable Flipper
95+
# RN 0.69.x and 0.70.x
96+
sed -i.bak "s|FlipperConfiguration.enabled|ENV['NO_FLIPPER'] == \"1\" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled|g" ios/Podfile
97+
# RN <= 0.68.x
98+
sed -i.bak 's|use_flipper!()|if ENV["NO_FLIPPER"] != "1"\n use_flipper!()\n end|g' ios/Podfile
99+
100+
# Fix Xcode 14 (react-native@0.67.x)
101+
sed -i.bak 's|node->getLayout().hadOverflow() \|\||node->getLayout().hadOverflow()\|\||g' node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp
102+
sed -i.bak 's|node->getLayout().hadOverflow() \||node->getLayout().hadOverflow()\|\||g' node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp
103+
104+
81105
# Update pods after adding new module
82106
npx pod-install
83-
107+
84108
# Build iOS App
85109
xcodebuild -scheme ${{ env.APP_NAME }} -workspace ios/${{ env.APP_NAME }}.xcworkspace -configuration Release -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' | xcbeautify --quiet
86-
87-
# set output variable
110+
111+
# set output variable
88112
echo "app_path=$(find ~/Library/Developer/Xcode/DerivedData -type d -name "${{ env.APP_NAME }}.app")" >> $GITHUB_OUTPUT
89113
else
90114
# Enable new arch for Android
@@ -94,7 +118,7 @@ runs:
94118
95119
# Build Android
96120
./android/gradlew assembleRelease --no-daemon -p android -PreactNativeArchitectures=${{ inputs.arch }}
97-
121+
98122
# set output variable
99123
echo "app_path=$(find $(pwd)/android -type f -name '*.apk')" >> $GITHUB_OUTPUT
100124
fi

.github/workflows/main.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
pull_request:
55
branches:
66
- master
7+
- new-arch
78
push:
89
branches:
910
- master
11+
- new-arch
1012

1113
concurrency:
1214
group: ${{ github.workflow }}-${{ github.ref }}
@@ -56,7 +58,8 @@ jobs:
5658
max-parallel: 4
5759
matrix:
5860
new_arch_enabled: [ 1, 0 ]
59-
rn_ver: [latest ] # also, can be any npm tag: 0.71-stable, next, nightly
61+
rn_ver: [latest] # also, can be any npm tag: 0.71-stable, next, nightly or version: 0.68, 0.70 ...
62+
6063
steps:
6164
- name: Checkout repository
6265
uses: actions/checkout@v3
@@ -70,6 +73,8 @@ jobs:
7073
module-to-install: file:${{ github.workspace }}
7174
store-artifacts: true
7275
platform: android
76+
node-version: ${{ contains(matrix.rn_ver, '0.5') && '14' || contains(matrix.rn_ver, '0.6') && '16' || '18' }}
77+
java-version: ${{ contains(matrix.rn_ver, '0.5') && '8' || contains(matrix.rn_ver, '0.6') && '11' || '17' }}
7378

7479
build-ios:
7580
name: Build iOS
@@ -79,7 +84,10 @@ jobs:
7984
max-parallel: 3
8085
matrix:
8186
new_arch_enabled: [ 1, 0 ]
82-
rn_ver: [latest ] # also, can be any npm tag: 0.71-stable, next, nightly
87+
rn_ver: [latest] # also, can be any npm tag: 0.71-stable, next, nightly or version: 0.68, 0.70 ...
88+
89+
90+
8391
steps:
8492
- name: Checkout repository
8593
uses: actions/checkout@v3
@@ -92,3 +100,5 @@ jobs:
92100
module-to-install: file:${{ github.workspace }}
93101
store-artifacts: true
94102
platform: ios
103+
node-version: ${{ contains(matrix.rn_ver, '0.5') && '14' || contains(matrix.rn_ver, '0.6') && '16' || '18' }}
104+
java-version: ${{ contains(matrix.rn_ver, '0.5') && '8' || contains(matrix.rn_ver, '0.6') && '11' || '17' }}

0 commit comments

Comments
 (0)