Skip to content

Commit 66341d7

Browse files
committed
ci(ios): simplify CocoaPods validation
1 parent ccf7e68 commit 66341d7

4 files changed

Lines changed: 13 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
retention-days: 7
240240

241241
ios-build-test:
242-
name: iOS (CocoaPods ${{ matrix.cocoapods }}, newArch=${{ matrix.new-arch }})
242+
name: iOS (newArch=${{ matrix.new-arch }})
243243
needs: changes
244244
if: needs.changes.outputs.ios == 'true'
245245
runs-on: macos-14
@@ -248,7 +248,6 @@ jobs:
248248
fail-fast: ${{ github.event_name == 'pull_request' }}
249249
max-parallel: 2
250250
matrix:
251-
cocoapods: ${{ fromJSON(github.event_name == 'pull_request' && '["1.14.3"]' || '["1.10.1","1.11.0","1.14.3"]') }}
252251
new-arch: ['0', '1']
253252
steps:
254253
- name: Checkout the code
@@ -260,39 +259,27 @@ jobs:
260259
- name: Set up Ruby
261260
uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1
262261
with:
263-
ruby-version: '2.7'
264-
bundler-cache: ${{ matrix.cocoapods == '1.14.3' }}
262+
ruby-version: '3.0'
263+
bundler-cache: true
265264
working-directory: example
266265

267-
- name: Install compatibility Ruby gems
268-
if: matrix.cocoapods != '1.14.3'
269-
run: |
270-
gem install ffi -v 1.17.4 --no-document
271-
gem install cocoapods -v ${{ matrix.cocoapods }} --no-document
272-
gem install xcpretty -v 0.3.0 --no-document
273-
274266
- name: Cache Pods
275267
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
276268
with:
277269
path: |
278270
example/ios/Pods
279271
~/Library/Caches/CocoaPods
280-
key: ${{ runner.os }}-pods-no-flipper-${{ matrix.cocoapods }}-new-arch-${{ matrix.new-arch }}-${{ hashFiles('example/ios/Podfile.lock', 'example/Gemfile.lock') }}
272+
key: ${{ runner.os }}-pods-no-flipper-new-arch-${{ matrix.new-arch }}-${{ hashFiles('example/ios/Podfile.lock', 'example/Gemfile.lock') }}
281273
restore-keys: |
282-
${{ runner.os }}-pods-no-flipper-${{ matrix.cocoapods }}-new-arch-${{ matrix.new-arch }}-
274+
${{ runner.os }}-pods-no-flipper-new-arch-${{ matrix.new-arch }}-
283275
284276
- name: Install Pods
285277
env:
286-
COCOAPODS_VERSION: ${{ matrix.cocoapods }}
287278
NO_FLIPPER: '1'
288279
RCT_NEW_ARCH_ENABLED: ${{ matrix.new-arch }}
289280
run: |
290281
cd example/ios
291-
if [[ "$COCOAPODS_VERSION" == "1.14.3" ]]; then
292-
bundle exec pod install
293-
else
294-
pod install
295-
fi
282+
bundle exec pod install
296283
297284
- name: Select an available iPhone simulator
298285
id: simulator
@@ -304,36 +291,19 @@ jobs:
304291
fi
305292
echo "udid=$simulator_udid" >> "$GITHUB_OUTPUT"
306293
307-
- name: Build
308-
env:
309-
COCOAPODS_VERSION: ${{ matrix.cocoapods }}
310-
run: |
311-
set -o pipefail
312-
cd example/ios
313-
if [[ "$COCOAPODS_VERSION" == "1.14.3" ]]; then
314-
xcodebuild -workspace BsDiffPatchExample.xcworkspace -scheme BsDiffPatchExample -configuration Release -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' | bundle exec xcpretty
315-
else
316-
xcodebuild -workspace BsDiffPatchExample.xcworkspace -scheme BsDiffPatchExample -configuration Release -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' | xcpretty
317-
fi
318-
319294
- name: Test
320295
env:
321-
COCOAPODS_VERSION: ${{ matrix.cocoapods }}
322296
SIMULATOR_UDID: ${{ steps.simulator.outputs.udid }}
323297
run: |
324298
set -o pipefail
325299
cd example/ios
326-
if [[ "$COCOAPODS_VERSION" == "1.14.3" ]]; then
327-
xcodebuild -workspace BsDiffPatchExample.xcworkspace -scheme BsDiffPatchExample -configuration Release -sdk iphonesimulator -destination "platform=iOS Simulator,id=$SIMULATOR_UDID" -resultBundlePath "$RUNNER_TEMP/ios-tests.xcresult" test | bundle exec xcpretty
328-
else
329-
xcodebuild -workspace BsDiffPatchExample.xcworkspace -scheme BsDiffPatchExample -configuration Release -sdk iphonesimulator -destination "platform=iOS Simulator,id=$SIMULATOR_UDID" -resultBundlePath "$RUNNER_TEMP/ios-tests.xcresult" test | xcpretty
330-
fi
300+
xcodebuild -workspace BsDiffPatchExample.xcworkspace -scheme BsDiffPatchExample -configuration Release -sdk iphonesimulator -destination "platform=iOS Simulator,id=$SIMULATOR_UDID" -resultBundlePath "$RUNNER_TEMP/ios-tests.xcresult" test | bundle exec xcpretty
331301
332302
- name: Upload iOS test results
333303
if: always()
334304
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
335305
with:
336-
name: iOS-Test-Results-${{ matrix.cocoapods }}-new-arch-${{ matrix.new-arch }}
306+
name: iOS-Test-Results-new-arch-${{ matrix.new-arch }}
337307
path: ${{ runner.temp }}/ios-tests.xcresult
338308
if-no-files-found: ignore
339309
retention-days: 7

docs/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Commit the regenerated `web/bsdiffpatch.mjs` with the C source change.
6666
## Native verification
6767

6868
Android CI builds both architecture modes and runs the New Architecture device
69-
round trip on its emulator matrix. iOS CI builds and tests legacy and New
70-
Architecture configurations across the supported CocoaPods matrix.
69+
round trip on its emulator matrix. iOS CI uses the CocoaPods version locked in
70+
the example Gemfile to build and test both legacy and New Architecture modes.
7171

7272
For local example commands, see [CONTRIBUTING.md](../CONTRIBUTING.md).
7373

docs/zh-CN/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ yarn test:web:browser
6464
## 原生验证
6565

6666
Android CI 构建两种架构模式,并在模拟器矩阵执行新架构设备级往返测试。iOS CI
67-
在受支持的 CocoaPods 矩阵中构建并测试旧架构和新架构配置
67+
使用示例 Gemfile 锁定的 CocoaPods 版本构建并测试旧架构和新架构配置
6868

6969
本地示例命令见仓库
7070
[CONTRIBUTING.md](https://github.com/JimmyDaddy/react-native-bs-diff-patch/blob/main/CONTRIBUTING.md)

example/Gemfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
source 'https://rubygems.org'
22

3-
# Keep the CI Ruby toolchain reproducible, including the last ffi release that
4-
# supports Ruby 2.7.
5-
ruby '>= 2.7.0'
3+
# The ARM64 ffi package requires Ruby 3 or newer.
4+
ruby '>= 3.0.0'
65

76
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
87
gem 'cocoapods', '1.14.3'

0 commit comments

Comments
 (0)