[CI] Upgrade the Demo to override the minOS of macOS (the i386 is no longer needed)

Split the github action
This commit is contained in:
DreamPiggy 2024-02-13 14:20:25 +08:00
parent 288305e9c1
commit 6cab6ca6be
2 changed files with 56 additions and 18 deletions

View File

@ -33,10 +33,10 @@ jobs:
- name: Install Xcpretty - name: Install Xcpretty
run: gem install xcpretty --no-document --quiet run: gem install xcpretty --no-document --quiet
- name: Pod Update. - name: Pod Update
run: pod repo update --silent run: pod repo update --silent
- name: Pod Install. - name: Pod Install
run: pod install run: pod install
- name: Run SDWebImage podspec lint - name: Run SDWebImage podspec lint
@ -44,8 +44,8 @@ jobs:
set -o pipefail set -o pipefail
pod lib lint SDWebImage.podspec --allow-warnings --skip-tests pod lib lint SDWebImage.podspec --allow-warnings --skip-tests
Pods: Demo:
name: Cocoapods Demo/Test name: Cocoapods Demo
runs-on: macos-13 runs-on: macos-13
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app DEVELOPER_DIR: /Applications/Xcode_15.2.app
@ -104,30 +104,65 @@ jobs:
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Vision Demo" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Vision Demo" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
Test:
name: Unit Test
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImage.xcworkspace
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
iosDestination: platform=iOS Simulator,name=iPhone 15 Pro
macOSDestination: platform=macOS,arch=x86_64
macCatalystDestination: platform=macOS,arch=x86_64,variant=Mac Catalyst
tvOSDestination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
watchOSDestination: platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)
visionOSDestination: platform=visionOS Simulator,name=Apple Vision Pro
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare VisionOS
run: |
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
xcodebuild -downloadPlatform visionOS
- name: Install Cocoapods
run: gem install cocoapods --no-document --quiet
- name: Install Xcpretty
run: gem install xcpretty --no-document --quiet
- name: Pod Update
run: pod repo update --silent
- name: Pod Install
run: pod install
- name: Clean DerivedData - name: Clean DerivedData
run: | run: |
rm -rf ~/Library/Developer/Xcode/DerivedData/ rm -rf ~/Library/Developer/Xcode/DerivedData/
mkdir DerivedData mkdir DerivedData
- name: Test - ${{ env.iosDestination }} - name: Test for iOS
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests iOS" -destination "${{ env.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests iOS" -destination "${{ env.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
- name: Test - ${{ env.macOSDestination }} - name: Test for macOS
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Mac" -destination "${{ env.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Mac" -destination "${{ env.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
- name: Test - ${{ env.tvOSDestination }} - name: Test for tvOS
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests TV" -destination "${{ env.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests TV" -destination "${{ env.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS
- name: Test - ${{ env.visionOSDestination }} - name: Test for visionOS
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Vision" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Vision" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO

21
Podfile
View File

@ -84,16 +84,19 @@ end
# Inject macro during SDWebImage Demo and Tests # Inject macro during SDWebImage Demo and Tests
post_install do |installer_representation| post_install do |installer_representation|
installer_representation.generated_pod_targets.each do |target| installer_representation.pods_project.targets.each do |target|
if target.pod_name == "SDWebImage" if target.product_name == 'SDWebImage'
build_settings = target.build_settings target.build_configurations.each do |config|
build_settings.each do |configuration, build_setting| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) SD_CHECK_CGIMAGE_RETAIN_SOURCE=1'
if configuration == :debug
config = build_setting.xcconfig
old_value = config.attributes['GCC_PREPROCESSOR_DEFINITIONS']
config.attributes['GCC_PREPROCESSOR_DEFINITIONS'] = old_value + ' SD_CHECK_CGIMAGE_RETAIN_SOURCE=1'
config.save_as(target.xcconfig_path(configuration))
end end
else
target.build_configurations.each do |config|
# Override the min deployment target for some test specs to workaround `libarclite.a` missing issue
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.11'
config.build_settings['TVOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '2.0'
config.build_settings['XROS_DEPLOYMENT_TARGET'] = '1.0'
end end
end end
end end