Upgrade the github-ci to macOS 14

This commit is contained in:
DreamPiggy 2024-03-09 23:01:39 +08:00
parent e057a3cda6
commit 94ae5347ba
1 changed files with 61 additions and 52 deletions

View File

@ -14,18 +14,24 @@ permissions:
jobs:
Pods:
name: Cocoapods Lint
runs-on: macos-13
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_15.2.app
steps:
- name: Checkout
uses: actions/checkout@v2
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: Run SDWebImageSwiftUI podspec lint
run: |
@ -34,24 +40,23 @@ jobs:
Demo:
name: Run Demo
runs-on: macos-13
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
OSXSCHEME: SDWebImageSwiftUIDemo-macOS
iOSSCHEME: SDWebImageSwiftUIDemo
TVSCHEME: SDWebImageSwiftUIDemo-tvOS
WATCHSCHEME: SDWebImageSwiftUIDemo-watchOS WatchKit App
strategy:
matrix:
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV"]
watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)"]
macOSDestination: ["platform=macOS"]
macCatalystDestination: ["platform=macOS,variant=Mac Catalyst"]
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@v2
uses: actions/checkout@v3
- name: Clean DerivedData
run: |
@ -73,46 +78,58 @@ 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 "${{ env.OSXSCHEME }}" -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 "${{ env.iOSSCHEME }}" -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 "${{ env.TVSCHEME }}" -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 "${{ env.WATCHSCHEME }}" -destination "${{ env.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
Test:
name: Unit Test
runs-on: macos-13
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
OSXSCHEME: SDWebImageSwiftUITests macOS
iOSSCHEME: SDWebImageSwiftUITests
TVSCHEME: SDWebImageSwiftUITests tvOS
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# use matrix to generate jobs for each platform
strategy:
fail-fast: false
matrix:
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
macOSDestination: ["platform=macOS"]
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV"]
platform: [iOS, macOS, tvOS]
include:
- platform: iOS
destination: platform=iOS Simulator,name=iPhone 15 Pro
scheme: SDWebImageSwiftUITests
flag: ios
- platform: macOS
destination: platform=macOS,arch=x86_64
scheme: SDWebImageSwiftUITests macOS
flag: macos
- platform: tvOS
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
scheme: SDWebImageSwiftUITests tvOS
flag: tvos
# - platform: visionOS
# destination: platform=visionOS Simulator,name=Apple Vision Pro
# scheme: Vision
# flag: visionos
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Clean DerivedData
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData/
mkdir DerivedData
- name: Install Cocoapods
run: gem install cocoapods --no-document --quiet
@ -124,39 +141,31 @@ jobs:
- name: Pod Install
run: pod install
- name: Clean DerivedData
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData/
mkdir DerivedData
- name: Test - ${{ matrix.iosDestination }}
- name: Run test
run: |
set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
- name: Test - ${{ matrix.macOSDestination }}
run: |
set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
- name: Test - ${{ matrix.tvOSDestination }}
run: |
set -o pipefail
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS
xcodebuild build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
xcodebuild test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
mv ~/Library/Developer/Xcode/DerivedData/ "./DerivedData/${{ matrix.platform }}"
- name: Code Coverage
run: |
set -o pipefail
export PATH="/usr/local/opt/curl/bin:$PATH"
curl --version
bash <(curl -s https://codecov.io/bash) -D './DerivedData/macOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F macos
bash <(curl -s https://codecov.io/bash) -D './DerivedData/iOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F ios
bash <(curl -s https://codecov.io/bash) -D './DerivedData/tvOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F tvos
bash <(curl -s https://codecov.io/bash) -v -D "./DerivedData/${{ matrix.platform }}" -J '^SDWebImageSwiftUI$' -c -X gcov -F "${{ matrix.flag }}"
Build:
name: Build Library
runs-on: macos-13
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_15.2.app
PROJECT_NAME: SDWebImageSwiftUI.xcodeproj
OSXSCHEME: SDWebImageSwiftUI macOS
iOSSCHEME: SDWebImageSwiftUI
@ -164,7 +173,7 @@ jobs:
WATCHSCHEME: SDWebImageSwiftUI watchOS
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build the SwiftPM
run: |