-
Notifications
You must be signed in to change notification settings - Fork 231
196 lines (165 loc) · 6.93 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: "SDWebImageSwiftUI CI"
on:
push:
branches:
- master
pull_request:
branches:
- '*'
permissions:
contents: read
jobs:
Pods:
name: Cocoapods Lint
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
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: Run SDWebImageSwiftUI podspec lint
run: |
set -o pipefail
pod lib lint SDWebImageSwiftUI.podspec --allow-warnings --skip-tests
Demo:
name: Run Demo
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
OSXSCHEME: SDWebImageSwiftUIDemo-macOS
iOSSCHEME: SDWebImageSwiftUIDemo
TVSCHEME: SDWebImageSwiftUIDemo-tvOS
WATCHSCHEME: SDWebImageSwiftUIDemo-watchOS WatchKit App
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: Clean DerivedData
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData/
mkdir DerivedData
- 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 demo for OSX
run: |
set -o pipefail
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 "${{ 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 "${{ 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 "${{ env.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
Test:
name: Unit Test
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# use matrix to generate jobs for each platform
strategy:
fail-fast: false
matrix:
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@v3
with:
fetch-depth: 0
- 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
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData/
mkdir DerivedData
- name: Run test
run: |
set -o pipefail
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) -v -D "./DerivedData/${{ matrix.platform }}" -J '^SDWebImageSwiftUI$' -c -X gcov -F "${{ matrix.flag }}"
Build:
name: Build Library
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
PROJECT_NAME: SDWebImageSwiftUI.xcodeproj
OSXSCHEME: SDWebImageSwiftUI macOS
iOSSCHEME: SDWebImageSwiftUI
TVSCHEME: SDWebImageSwiftUI tvOS
WATCHSCHEME: SDWebImageSwiftUI watchOS
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build the SwiftPM
run: |
set -o pipefail
swift build
rm -rf ~/.build
- name: Install Carthage
run: brew install carthage
- name: Carthage Update
run: ./carthage.sh update --platform "iOS, tvOS, macOS, watchOS"
- name: Build as dynamic frameworks
run: |
set -o pipefail
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.OSXSCHEME }}" -sdk macosx -configuration Release | xcpretty -c
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.iOSSCHEME }}" -sdk iphoneos -configuration Release | xcpretty -c
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.TVSCHEME }}" -sdk appletvos -configuration Release | xcpretty -c
xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -sdk watchos -configuration Release | xcpretty -c