CI.yml 7.2 KB

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