Skip to content

Commit 3afc34c

Browse files
authored
Merge pull request #302 from SDWebImage/ci
Upgrade the github-ci to macOS 14
2 parents e057a3c + fbfd186 commit 3afc34c

File tree

4 files changed

+90
-56
lines changed

4 files changed

+90
-56
lines changed

.github/workflows/CI.yml

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ permissions:
1414
jobs:
1515
Pods:
1616
name: Cocoapods Lint
17-
runs-on: macos-13
17+
runs-on: macos-14
1818
env:
19-
DEVELOPER_DIR: /Applications/Xcode_14.1.app
19+
DEVELOPER_DIR: /Applications/Xcode_15.2.app
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323

2424
- name: Install Cocoapods
2525
run: gem install cocoapods --no-document --quiet
2626

2727
- name: Install Xcpretty
2828
run: gem install xcpretty --no-document --quiet
29+
30+
- name: Pod Update
31+
run: pod repo update --silent
32+
33+
- name: Pod Install
34+
run: pod install
2935

3036
- name: Run SDWebImageSwiftUI podspec lint
3137
run: |
@@ -34,24 +40,23 @@ jobs:
3440
3541
Demo:
3642
name: Run Demo
37-
runs-on: macos-13
43+
runs-on: macos-14
3844
env:
39-
DEVELOPER_DIR: /Applications/Xcode_14.1.app
45+
DEVELOPER_DIR: /Applications/Xcode_15.2.app
4046
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
4147
OSXSCHEME: SDWebImageSwiftUIDemo-macOS
4248
iOSSCHEME: SDWebImageSwiftUIDemo
4349
TVSCHEME: SDWebImageSwiftUIDemo-tvOS
4450
WATCHSCHEME: SDWebImageSwiftUIDemo-watchOS WatchKit App
45-
strategy:
46-
matrix:
47-
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
48-
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV"]
49-
watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)"]
50-
macOSDestination: ["platform=macOS"]
51-
macCatalystDestination: ["platform=macOS,variant=Mac Catalyst"]
51+
iosDestination: platform=iOS Simulator,name=iPhone 15 Pro
52+
macOSDestination: platform=macOS,arch=x86_64
53+
macCatalystDestination: platform=macOS,arch=x86_64,variant=Mac Catalyst
54+
tvOSDestination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
55+
watchOSDestination: platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)
56+
visionOSDestination: platform=visionOS Simulator,name=Apple Vision Pro
5257
steps:
5358
- name: Checkout
54-
uses: actions/checkout@v2
59+
uses: actions/checkout@v3
5560

5661
- name: Clean DerivedData
5762
run: |
@@ -73,46 +78,58 @@ jobs:
7378
- name: Run demo for OSX
7479
run: |
7580
set -o pipefail
76-
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
81+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ env.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
7782
7883
- name: Run demo for iOS
7984
run: |
8085
set -o pipefail
81-
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
86+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ env.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
8287
8388
- name: Run demo for TV
8489
run: |
8590
set -o pipefail
86-
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
91+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ env.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
8792
8893
- name: Run demo for Watch
8994
run: |
9095
set -o pipefail
91-
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -destination "${{ matrix.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
96+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -destination "${{ env.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
9297
9398
Test:
9499
name: Unit Test
95-
runs-on: macos-13
100+
runs-on: macos-14
96101
env:
97-
DEVELOPER_DIR: /Applications/Xcode_14.1.app
102+
DEVELOPER_DIR: /Applications/Xcode_15.2.app
98103
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
99-
OSXSCHEME: SDWebImageSwiftUITests macOS
100-
iOSSCHEME: SDWebImageSwiftUITests
101-
TVSCHEME: SDWebImageSwiftUITests tvOS
104+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
105+
# use matrix to generate jobs for each platform
102106
strategy:
107+
fail-fast: false
103108
matrix:
104-
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
105-
macOSDestination: ["platform=macOS"]
106-
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV"]
109+
platform: [iOS, macOS, tvOS]
110+
include:
111+
- platform: iOS
112+
destination: platform=iOS Simulator,name=iPhone 15 Pro
113+
scheme: SDWebImageSwiftUITests
114+
flag: ios
115+
- platform: macOS
116+
destination: platform=macOS,arch=x86_64
117+
scheme: SDWebImageSwiftUITests macOS
118+
flag: macos
119+
- platform: tvOS
120+
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
121+
scheme: SDWebImageSwiftUITests tvOS
122+
flag: tvos
123+
# - platform: visionOS
124+
# destination: platform=visionOS Simulator,name=Apple Vision Pro
125+
# scheme: Vision
126+
# flag: visionos
107127
steps:
108128
- name: Checkout
109-
uses: actions/checkout@v2
129+
uses: actions/checkout@v3
130+
with:
131+
fetch-depth: 0
110132

111-
- name: Clean DerivedData
112-
run: |
113-
rm -rf ~/Library/Developer/Xcode/DerivedData/
114-
mkdir DerivedData
115-
116133
- name: Install Cocoapods
117134
run: gem install cocoapods --no-document --quiet
118135

@@ -124,47 +141,40 @@ jobs:
124141

125142
- name: Pod Install
126143
run: pod install
127-
128-
- name: Test - ${{ matrix.iosDestination }}
129-
run: |
130-
set -o pipefail
131-
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
132-
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
133-
134-
- name: Test - ${{ matrix.macOSDestination }}
144+
145+
- name: Clean DerivedData
135146
run: |
136-
set -o pipefail
137-
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
138-
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
139-
140-
- name: Test - ${{ matrix.tvOSDestination }}
147+
rm -rf ~/Library/Developer/Xcode/DerivedData/
148+
mkdir DerivedData
149+
150+
- name: Run test
141151
run: |
142152
set -o pipefail
143-
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
144-
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS
153+
xcodebuild build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
154+
xcodebuild test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
155+
mv ~/Library/Developer/Xcode/DerivedData/ "./DerivedData/${{ matrix.platform }}"
145156
146157
- name: Code Coverage
147158
run: |
148159
set -o pipefail
149160
export PATH="/usr/local/opt/curl/bin:$PATH"
150161
curl --version
151-
bash <(curl -s https://codecov.io/bash) -D './DerivedData/macOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F macos
152-
bash <(curl -s https://codecov.io/bash) -D './DerivedData/iOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F ios
153-
bash <(curl -s https://codecov.io/bash) -D './DerivedData/tvOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F tvos
162+
bash <(curl -s https://codecov.io/bash) -v -D "./DerivedData/${{ matrix.platform }}" -J '^SDWebImageSwiftUI$' -c -X gcov -F "${{ matrix.flag }}"
154163
155164
Build:
156165
name: Build Library
157-
runs-on: macos-13
166+
runs-on: macos-14
158167
env:
159-
DEVELOPER_DIR: /Applications/Xcode_14.1.app
168+
DEVELOPER_DIR: /Applications/Xcode_15.2.app
160169
PROJECT_NAME: SDWebImageSwiftUI.xcodeproj
161170
OSXSCHEME: SDWebImageSwiftUI macOS
162171
iOSSCHEME: SDWebImageSwiftUI
163172
TVSCHEME: SDWebImageSwiftUI tvOS
164173
WATCHSCHEME: SDWebImageSwiftUI watchOS
174+
VISIONOSSCHEME: SDWebImageSwiftUI visionOS
165175
steps:
166176
- name: Checkout
167-
uses: actions/checkout@v2
177+
uses: actions/checkout@v3
168178

169179
- name: Build the SwiftPM
170180
run: |
@@ -176,7 +186,7 @@ jobs:
176186
run: brew install carthage
177187

178188
- name: Carthage Update
179-
run: ./carthage.sh update --platform "iOS, tvOS, macOS, watchOS"
189+
run: ./carthage.sh update --platform "iOS, tvOS, macOS, watchOS, visionOS"
180190

181191
- name: Build as dynamic frameworks
182192
run: |
@@ -185,3 +195,4 @@ jobs:
185195
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.iOSSCHEME }}" -sdk iphoneos -configuration Release | xcpretty -c
186196
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.TVSCHEME }}" -sdk appletvos -configuration Release | xcpretty -c
187197
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -sdk watchos -configuration Release | xcpretty -c
198+
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.VISIONOSSCHEME }}" -sdk xros -configuration Release | xcpretty -c

Podfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,27 @@ target 'SDWebImageSwiftUITests tvOS' do
5959
project test_project_path
6060
platform :tvos, '14.0'
6161
all_test_pods
62-
end
62+
end
63+
64+
65+
# Inject macro during SDWebImage Demo and Tests
66+
post_install do |installer_representation|
67+
installer_representation.pods_project.targets.each do |target|
68+
if target.product_name == 'SDWebImage'
69+
target.build_configurations.each do |config|
70+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) SD_CHECK_CGIMAGE_RETAIN_SOURCE=1'
71+
end
72+
elsif target.product_name == 'SDWebImageSwiftUI'
73+
# Do nothing
74+
else
75+
target.build_configurations.each do |config|
76+
# Override the min deployment target for some test specs to workaround `libarclite.a` missing issue
77+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
78+
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.11'
79+
config.build_settings['TVOS_DEPLOYMENT_TARGET'] = '9.0'
80+
config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '2.0'
81+
config.build_settings['XROS_DEPLOYMENT_TARGET'] = '1.0'
82+
end
83+
end
84+
end
85+
end

Tests/ImageManagerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ImageManagerTests: XCTestCase {
1717

1818
func testImageManager() throws {
1919
let expectation = self.expectation(description: "ImageManager usage with Combine")
20-
let imageUrl = URL(string: "https://via.placeholder.com/500x500.jpg")
20+
let imageUrl = URL(string: "https://placehold.co/500x500.jpg")
2121
let imageManager = ImageManager()
2222
imageManager.setOnSuccess { image, cacheType, data in
2323
XCTAssertNotNil(image)

Tests/WebImageTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class WebImageTests: XCTestCase {
137137

138138
func testWebImageOnSuccessWhenCacheMiss() throws {
139139
let expectation = self.expectation(description: "WebImage onSuccess when cache miss")
140-
let imageUrl = URL(string: "http://via.placeholder.com/100x100.png")
140+
let imageUrl = URL(string: "https://placehold.co/100x100.png")
141141
let cacheKey = SDWebImageManager.shared.cacheKey(for: imageUrl)
142142
SDImageCache.shared.removeImageFromMemory(forKey: cacheKey)
143143
SDImageCache.shared.removeImageFromDisk(forKey: cacheKey)

0 commit comments

Comments
 (0)