Skip to content

Commit 3258812

Browse files
authored
Merge pull request #227 from SDWebImage/refactor_xcode14_state_update
Refactor WebImage/AnimatedImage using SwiftUIBackports and StateObject
2 parents 336d3f6 + f263e8e commit 3258812

29 files changed

+1657
-898
lines changed

.github/workflows/CI.yml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
name: "SDWebImageSwiftUI CI"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
Pods:
16+
name: Cocoapods Lint
17+
runs-on: macos-11
18+
env:
19+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Install Cocoapods
25+
run: gem install cocoapods --no-document --quiet
26+
27+
- name: Install Xcpretty
28+
run: gem install xcpretty --no-document --quiet
29+
30+
- name: Run SDWebImageSwiftUI podspec lint
31+
run: |
32+
set -o pipefail
33+
pod lib lint SDWebImageSwiftUI.podspec --allow-warnings --skip-tests
34+
35+
Demo:
36+
name: Run Demo
37+
runs-on: macos-11
38+
env:
39+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
40+
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
41+
OSXSCHEME: SDWebImageSwiftUIDemo-macOS
42+
iOSSCHEME: SDWebImageSwiftUIDemo
43+
TVSCHEME: SDWebImageSwiftUIDemo-tvOS
44+
WATCHSCHEME: SDWebImageSwiftUIDemo-watchOS WatchKit App
45+
strategy:
46+
matrix:
47+
iosDestination: ["name=iPhone 13 Pro"]
48+
tvOSDestination: ["name=Apple TV 4K"]
49+
watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 7 - 45mm"]
50+
macOSDestination: ["platform=macOS"]
51+
macCatalystDestination: ["platform=macOS,arch=x86_64,variant=Mac Catalyst"]
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v2
55+
56+
- name: Clean DerivedData
57+
run: |
58+
rm -rf ~/Library/Developer/Xcode/DerivedData/
59+
mkdir DerivedData
60+
61+
- name: Install Cocoapods
62+
run: gem install cocoapods --no-document --quiet
63+
64+
- name: Install Xcpretty
65+
run: gem install xcpretty --no-document --quiet
66+
67+
- name: Pod Update
68+
run: pod repo update --silent
69+
70+
- name: Pod Install
71+
run: pod install
72+
73+
- name: Run demo for OSX
74+
run: |
75+
set -o pipefail
76+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
77+
78+
- name: Run demo for iOS
79+
run: |
80+
set -o pipefail
81+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
82+
83+
- name: Run demo for TV
84+
run: |
85+
set -o pipefail
86+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
87+
88+
- name: Run demo for Watch
89+
run: |
90+
set -o pipefail
91+
xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -destination "${{ matrix.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
92+
93+
Test:
94+
name: Unit Test
95+
runs-on: macos-11
96+
env:
97+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
98+
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
99+
OSXSCHEME: SDWebImageSwiftUITests macOS
100+
iOSSCHEME: SDWebImageSwiftUITests
101+
TVSCHEME: SDWebImageSwiftUITests tvOS
102+
strategy:
103+
matrix:
104+
iosDestination: ["platform=iOS Simulator,name=iPhone 13 Pro"]
105+
macOSDestination: ["platform=macOS,arch=x86_64"]
106+
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV 4K"]
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v2
110+
111+
- name: Clean DerivedData
112+
run: |
113+
rm -rf ~/Library/Developer/Xcode/DerivedData/
114+
mkdir DerivedData
115+
116+
- name: Install Cocoapods
117+
run: gem install cocoapods --no-document --quiet
118+
119+
- name: Install Xcpretty
120+
run: gem install xcpretty --no-document --quiet
121+
122+
- name: Pod Update
123+
run: pod repo update --silent
124+
125+
- name: Pod Install
126+
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 }}
135+
run: |
136+
set -o pipefail
137+
xcodebuild test -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
138+
mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS
139+
140+
- name: Test - ${{ matrix.tvOSDestination }}
141+
run: |
142+
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
145+
146+
- name: Code Coverage
147+
run: |
148+
set -o pipefail
149+
export PATH="/usr/local/opt/curl/bin:$PATH"
150+
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
154+
155+
Build:
156+
name: Build Library
157+
runs-on: macos-11
158+
env:
159+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
160+
PROJECT_NAME: SDWebImageSwiftUI.xcodeproj
161+
OSXSCHEME: SDWebImageSwiftUI macOS
162+
iOSSCHEME: SDWebImageSwiftUI
163+
TVSCHEME: SDWebImageSwiftUI tvOS
164+
WATCHSCHEME: SDWebImageSwiftUI watchOS
165+
steps:
166+
- name: Checkout
167+
uses: actions/checkout@v2
168+
169+
- name: Build the SwiftPM
170+
run: |
171+
set -o pipefail
172+
swift build
173+
rm -rf ~/.build
174+
175+
- name: Install Carthage
176+
run: brew install carthage
177+
178+
- name: Carthage Update
179+
run: ./carthage.sh update --platform "iOS, tvOS, macOS, watchOS"
180+
181+
- name: Build as dynamic frameworks
182+
run: |
183+
set -o pipefail
184+
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.OSXSCHEME }}" -sdk macosx -configuration Release | xcpretty -c
185+
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.iOSSCHEME }}" -sdk iphoneos -configuration Release | xcpretty -c
186+
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.TVSCHEME }}" -sdk appletvos -configuration Release | xcpretty -c
187+
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -sdk watchos -configuration Release | xcpretty -c

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ Podfile.lock
4141
# SwiftPM
4242
.build
4343
.swiftpm
44+
Package.resolved

Example/Podfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)