From 288305e9c1f1b2b6e77ca822cacc440752ecbfbb Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 13 Feb 2024 13:41:54 +0800 Subject: [PATCH] Use the tricks to run visionOS simulator on x86_64 github action runner --- .github/workflows/CI.yml | 109 ++++++++++++++------------------------- 1 file changed, 40 insertions(+), 69 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6a9cbcf9..04d760a3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,7 +12,7 @@ permissions: contents: read jobs: - Pods: + Lint: name: Cocoapods Lint runs-on: macos-13 env: @@ -21,6 +21,12 @@ jobs: - 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 @@ -38,29 +44,29 @@ jobs: set -o pipefail pod lib lint SDWebImage.podspec --allow-warnings --skip-tests - Demo: - name: Run Demo + Pods: + name: Cocoapods Demo/Test runs-on: macos-13 env: DEVELOPER_DIR: /Applications/Xcode_15.2.app WORKSPACE_NAME: SDWebImage.xcworkspace - OSXSCHEME: SDWebImage OSX Demo - iOSSCHEME: SDWebImage iOS Demo - TVSCHEME: SDWebImage TV Demo - WATCHSCHEME: SDWebImage Watch Demo - VISIONSCHEME: SDWebImage Vision Demo - strategy: - matrix: - 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"] + 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 @@ -76,84 +82,55 @@ jobs: - name: Run demo for OSX run: | 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 run: | 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 run: | 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 run: | 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 run: | set -o pipefail - xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.VISIONSCHEME }}" -destination "${{ matrix.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 + xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Vision Demo" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c - name: Clean DerivedData run: | rm -rf ~/Library/Developer/Xcode/DerivedData/ mkdir DerivedData - - name: Test - ${{ matrix.iosDestination }} + - name: Test - ${{ env.iosDestination }} run: | 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 - - name: Test - ${{ matrix.macOSDestination }} + - name: Test - ${{ env.macOSDestination }} run: | 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 - - name: Test - ${{ matrix.tvOSDestination }} + - name: Test - ${{ env.tvOSDestination }} run: | 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 - - name: Test - ${{ matrix.visionOSDestination }} + - name: Test - ${{ env.visionOSDestination }} run: | 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 - name: Code Coverage @@ -177,17 +154,11 @@ jobs: - 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: Prepare VisionOS + run: | + defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES + defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES + xcodebuild -downloadPlatform visionOS - name: Build the SwiftPM run: |