Use the tricks to run visionOS simulator on x86_64 github action runner

This commit is contained in:
DreamPiggy 2024-02-13 13:41:54 +08:00
parent aaad37213b
commit 288305e9c1
1 changed files with 40 additions and 69 deletions

View File

@ -12,7 +12,7 @@ permissions:
contents: read contents: read
jobs: jobs:
Pods: Lint:
name: Cocoapods Lint name: Cocoapods Lint
runs-on: macos-13 runs-on: macos-13
env: env:
@ -21,6 +21,12 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 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 - name: Install Cocoapods
run: gem install cocoapods --no-document --quiet run: gem install cocoapods --no-document --quiet
@ -38,29 +44,29 @@ 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
Demo: Pods:
name: Run Demo name: Cocoapods Demo/Test
runs-on: macos-13 runs-on: macos-13
env: env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImage.xcworkspace WORKSPACE_NAME: SDWebImage.xcworkspace
OSXSCHEME: SDWebImage OSX Demo CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
iOSSCHEME: SDWebImage iOS Demo iosDestination: platform=iOS Simulator,name=iPhone 15 Pro
TVSCHEME: SDWebImage TV Demo macOSDestination: platform=macOS,arch=x86_64
WATCHSCHEME: SDWebImage Watch Demo macCatalystDestination: platform=macOS,arch=x86_64,variant=Mac Catalyst
VISIONSCHEME: SDWebImage Vision Demo tvOSDestination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
strategy: watchOSDestination: platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)
matrix: visionOSDestination: platform=visionOS Simulator,name=Apple Vision Pro
iosDestination: ["name=iPhone 13 Pro"]
tvOSDestination: ["name=Apple TV 4K"]
watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 7 - 45mm"]
macOSDestination: ["platform=macOS"]
macCatalystDestination: ["platform=macOS,arch=x86_64,variant=Mac Catalyst"]
visionOSDestination: ["platform=visionOS Simulator,name=Apple Vision Pro"]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 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 - name: Install Cocoapods
run: gem install cocoapods --no-document --quiet run: gem install cocoapods --no-document --quiet
@ -76,84 +82,55 @@ jobs:
- name: Run demo for OSX - name: Run demo for OSX
run: | run: |
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage OSX Demo" -destination "${{ env.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
- name: Run demo for iOS - name: Run demo for iOS
run: | run: |
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage iOS Demo" -destination "${{ env.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
- name: Run demo for TV - name: Run demo for TV
run: | run: |
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage TV Demo" -destination "${{ env.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
- name: Run demo for Watch - name: Run demo for Watch
run: | run: |
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -destination "${{ matrix.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Watch Demo" -destination "${{ env.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
- name: Run demo for Vision - name: Run demo for Vision
run: | run: |
set -o pipefail set -o pipefail
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.VISIONSCHEME }}" -destination "${{ matrix.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 }}
strategy:
matrix:
iosDestination: ["platform=iOS Simulator,name=iPhone 13 Pro"]
macOSDestination: ["platform=macOS,arch=x86_64"]
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV 4K"]
visionOSDestination: ["platform=visionOS Simulator,name=Apple Vision Pro"]
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 - ${{ matrix.iosDestination }} - name: Test - ${{ env.iosDestination }}
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests iOS" -destination "${{ matrix.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 - ${{ matrix.macOSDestination }} - name: Test - ${{ env.macOSDestination }}
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Mac" -destination "${{ matrix.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 - ${{ matrix.tvOSDestination }} - name: Test - ${{ env.tvOSDestination }}
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests TV" -destination "${{ matrix.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 - ${{ matrix.visionOSDestination }} - name: Test - ${{ env.visionOSDestination }}
run: | run: |
set -o pipefail set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests Vision" -destination "${{ matrix.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
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/visionOS mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/visionOS
- name: Code Coverage - name: Code Coverage
@ -177,17 +154,11 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install Cocoapods - name: Prepare VisionOS
run: gem install cocoapods --no-document --quiet run: |
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
- name: Install Xcpretty defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
run: gem install xcpretty --no-document --quiet xcodebuild -downloadPlatform visionOS
- name: Pod Update
run: pod repo update --silent
- name: Pod Install
run: pod install
- name: Build the SwiftPM - name: Build the SwiftPM
run: | run: |