CI.yml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. name: "SDWebImage CI"
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. branches:
  8. - '*'
  9. permissions:
  10. contents: read
  11. jobs:
  12. Lint:
  13. name: Cocoapods Lint
  14. runs-on: macos-15
  15. env:
  16. LC_ALL: en_US.UTF-8
  17. DEVELOPER_DIR: /Applications/Xcode_16.3.app
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v3
  21. - name: Install Cocoapods
  22. run: gem install cocoapods --no-document --quiet
  23. - name: Install Xcpretty
  24. run: gem install xcpretty --no-document --quiet
  25. - name: Pod Update
  26. run: pod repo update --silent
  27. - name: Pod Install
  28. run: pod install
  29. - name: Run SDWebImage podspec lint
  30. run: |
  31. set -o pipefail
  32. pod lib lint SDWebImage.podspec --allow-warnings --skip-tests
  33. Demo:
  34. name: Cocoapods Demo
  35. runs-on: macos-15
  36. env:
  37. LC_ALL: en_US.UTF-8
  38. DEVELOPER_DIR: /Applications/Xcode_16.3.app
  39. WORKSPACE_NAME: SDWebImage.xcworkspace
  40. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  41. iosDestination: generic/platform=iOS Simulator
  42. macOSDestination: platform=macOS,arch=x86_64
  43. macCatalystDestination: platform=macOS,arch=x86_64,variant=Mac Catalyst
  44. tvOSDestination: generic/platform=tvOS Simulator
  45. watchOSDestination: generic/platform=watchOS Simulator
  46. visionOSDestination: generic/platform=visionOS Simulator
  47. steps:
  48. - name: Checkout
  49. uses: actions/checkout@v3
  50. - name: Install Cocoapods
  51. run: gem install cocoapods --no-document --quiet
  52. - name: Install Xcpretty
  53. run: gem install xcpretty --no-document --quiet
  54. - name: Pod Update
  55. run: pod repo update --silent
  56. - name: Pod Install
  57. run: pod install
  58. - name: Run demo for OSX
  59. run: |
  60. set -o pipefail
  61. xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage OSX Demo" -destination "${{ env.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  62. - name: Run demo for iOS
  63. run: |
  64. set -o pipefail
  65. xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage iOS Demo" -destination "${{ env.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  66. - name: Run demo for TV
  67. run: |
  68. set -o pipefail
  69. xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage TV Demo" -destination "${{ env.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  70. - name: Run demo for Watch
  71. run: |
  72. set -o pipefail
  73. xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Watch Demo" -destination "${{ env.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  74. - name: Run demo for Vision
  75. run: |
  76. set -o pipefail
  77. xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "SDWebImage Vision Demo" -destination "${{ env.visionOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  78. Test:
  79. name: Unit Test
  80. runs-on: macos-15
  81. env:
  82. LC_ALL: en_US.UTF-8
  83. DEVELOPER_DIR: /Applications/Xcode_16.3.app
  84. WORKSPACE_NAME: SDWebImage.xcworkspace
  85. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  86. # use matrix to generate jobs for each platform
  87. strategy:
  88. fail-fast: false
  89. matrix:
  90. platform: [iOS, macOS, tvOS, visionOS]
  91. include:
  92. - platform: iOS
  93. destination: platform=iOS Simulator,name=iPhone 16 Pro Max
  94. scheme: iOS
  95. flag: ios
  96. - platform: macOS
  97. destination: platform=macOS,arch=x86_64
  98. scheme: Mac
  99. flag: macos
  100. - platform: tvOS
  101. destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
  102. scheme: TV
  103. flag: tvos
  104. - platform: visionOS
  105. destination: platform=visionOS Simulator,name=Apple Vision Pro,OS=2.4
  106. scheme: Vision
  107. flag: visionos
  108. steps:
  109. - name: Checkout
  110. uses: actions/checkout@v3
  111. with:
  112. fetch-depth: 0
  113. - name: Install Cocoapods
  114. run: gem install cocoapods --no-document --quiet
  115. - name: Install Xcpretty
  116. run: gem install xcpretty --no-document --quiet
  117. - name: Pod Update
  118. run: pod repo update --silent
  119. - name: Pod Install
  120. run: pod install
  121. - name: Clean DerivedData
  122. run: |
  123. rm -rf ~/Library/Developer/Xcode/DerivedData/
  124. mkdir DerivedData
  125. - name: Run test
  126. run: |
  127. set -o pipefail
  128. xcodebuild build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests ${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c
  129. xcodebuild test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "Tests ${{ matrix.scheme }}" -destination "${{ matrix.destination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO
  130. mv ~/Library/Developer/Xcode/DerivedData/ "./DerivedData/${{ matrix.platform }}"
  131. - name: Code Coverage
  132. run: |
  133. set -o pipefail
  134. export PATH="/usr/local/opt/curl/bin:$PATH"
  135. curl --version
  136. bash <(curl -s https://codecov.io/bash) -v -D "./DerivedData/${{ matrix.platform }}" -J '^SDWebImage$' -c -X gcov -F "${{ matrix.flag }}"
  137. Build:
  138. name: Build Library
  139. runs-on: macos-15
  140. env:
  141. LC_ALL: en_US.UTF-8
  142. DEVELOPER_DIR: /Applications/Xcode_16.3.app
  143. PROJECT_NAME: SDWebImage.xcodeproj
  144. SCHEME_NAME: SDWebImage
  145. steps:
  146. - name: Checkout
  147. uses: actions/checkout@v3
  148. - name: Build the SwiftPM
  149. run: |
  150. set -o pipefail
  151. swift build
  152. rm -rf ~/.build
  153. - name: Build as static library
  154. run: |
  155. set -o pipefail
  156. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "SDWebImage static" -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c
  157. rm -rf ~/Library/Developer/Xcode/DerivedData/
  158. - name: Build as dynamic frameworks
  159. run: |
  160. set -o pipefail
  161. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -sdk macosx -configuration Debug | xcpretty -c
  162. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c
  163. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -sdk appletvsimulator -configuration Debug | xcpretty -c
  164. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -sdk watchsimulator -configuration Debug | xcpretty -c
  165. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS,arch=x86_64,variant=Mac Catalyst" -configuration Debug | xcpretty -c
  166. xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -sdk xrsimulator -configuration Debug | xcpretty -c
  167. rm -rf ~/Library/Developer/Xcode/DerivedData/