From 4b7cbfcf06299db204b4776ab5db53b139440d3f Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 15 Sep 2022 01:13:54 +0800 Subject: [PATCH] Fix the CI, re-enable GitHub Actions --- .github/workflows/CI.yml | 165 ++++++++++++++++++ .gitignore | 1 + Example/Podfile | 6 +- .../project.pbxproj | 8 +- .../xcshareddata/swiftpm/Package.resolved | 16 -- carthage.sh | 12 +- 6 files changed, 178 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/CI.yml delete mode 100644 SDWebImageSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..78ff209 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,165 @@ +name: "SDWebImageSwiftUI CI" + +on: + push: + branches: + - master + pull_request: + branches: + - '*' + +permissions: + contents: read + +jobs: + Pods: + name: Cocoapods Lint + runs-on: macos-11 + env: + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Cocoapods + run: gem install cocoapods --no-document --quiet + + - name: Install Xcpretty + run: gem install xcpretty --no-document --quiet + + - 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-11 + env: + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app + WORKSPACE_NAME: SDWebImageSwiftUI.xcworkspace + OSXSCHEME: SDWebImageSwiftUIDemo-macOS + iOSSCHEME: SDWebImageSwiftUIDemo + TVSCHEME: SDWebImageSwiftUIDemo-tvOS + WATCHSCHEME: SDWebImageSwiftUIDemo-watchOS WatchKit App + strategy: + matrix: + iosDestination: ["name=iPhone 13 Pro"] + tvOSDestination: ["name=Apple TV 4K"] + watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 7 - 45mm"] + macOSDestination: ["platform=macOS"] + macCatalystDestination: ["platform=macOS,arch=x86_64,variant=Mac Catalyst"] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Cocoapods + run: gem install cocoapods --no-document --quiet + + - name: Install Xcpretty + run: gem install xcpretty --no-document --quiet + + - name: Pod Update + working-directory: ./Example + run: pod repo update --silent + + - name: Pod Install + working-directory: ./Example + run: pod install + + - name: Run demo for OSX + working-directory: ./Example + run: | + set -o pipefail + xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + + - name: Run demo for iOS + working-directory: ./Example + run: | + set -o pipefail + xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + + - name: Run demo for TV + working-directory: ./Example + run: | + set -o pipefail + xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + + - name: Run demo for Watch + working-directory: ./Example + run: | + set -o pipefail + xcodebuild build -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.WATCHSCHEME }}" -destination "${{ matrix.watchOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + + Test: + name: Unit Test + runs-on: macos-11 + env: + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app + PROJECT_NAME: SDWebImageSwiftUI.xcodeproj + OSXSCHEME: SDWebImageSwiftUITests macOS + iOSSCHEME: SDWebImageSwiftUITests + TVSCHEME: SDWebImageSwiftUITests tvOS + strategy: + matrix: + iosDestination: ["platform=iOS Simulator,name=iPhone 13 Pro"] + macOSDestination: ["platform=macOS,arch=x86_64"] + tvOSDestination: ["platform=tvOS Simulator,name=Apple TV 4K"] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Carthage + run: brew install carthage + + - name: Carthage Update + run: ./carthage.sh update --platform "iOS, tvOS, macOS" + + - name: Clean DerivedData + run: | + rm -rf ~/Library/Developer/Xcode/DerivedData/ + mkdir DerivedData + + - name: Test - ${{ matrix.iosDestination }} + run: | + set -o pipefail + xcodebuild test -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.iOSSCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS + + - name: Test - ${{ matrix.macOSDestination }} + run: | + set -o pipefail + xcodebuild test -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.OSXSCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/macOS + + - name: Test - ${{ matrix.tvOSDestination }} + run: | + set -o pipefail + xcodebuild test -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.TVSCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug CODE_SIGNING_ALLOWED=NO | xcpretty -c + mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/tvOS + + - name: Code Coverage + run: | + set -o pipefail + export PATH="/usr/local/opt/curl/bin:$PATH" + curl --version + bash <(curl -s https://codecov.io/bash) -D './DerivedData/macOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F macos + bash <(curl -s https://codecov.io/bash) -D './DerivedData/iOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F ios + bash <(curl -s https://codecov.io/bash) -D './DerivedData/tvOS' -J '^SDWebImageSwiftUI$' -c -X gcov -F tvos + + Build: + name: Build Library + runs-on: macos-11 + env: + DEVELOPER_DIR: /Applications/Xcode_13.2.1.app + PROJECT_NAME: SDWebImageSwiftUI.xcodeproj + SCHEME_NAME: SDWebImageSwiftUI + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Build the SwiftPM + run: | + set -o pipefail + swift build + rm -rf ~/.build diff --git a/.gitignore b/.gitignore index 2b4d872..832611e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ Podfile.lock # SwiftPM .build .swiftpm +Package.resolved diff --git a/Example/Podfile b/Example/Podfile index d570628..0315a9a 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,17 +8,17 @@ def all_pods end target 'SDWebImageSwiftUIDemo' do - platform :ios, '13.0' + platform :ios, '14.0' all_pods end target 'SDWebImageSwiftUIDemo-macOS' do - platform :osx, '10.15' + platform :osx, '11.0' all_pods end target 'SDWebImageSwiftUIDemo-tvOS' do - platform :tvos, '13.0' + platform :tvos, '14.0' all_pods end diff --git a/Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj b/Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj index d1c549b..1a0580a 100644 --- a/Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj +++ b/Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj @@ -961,7 +961,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "SDWebImageSwiftUIDemo-macOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUIDemo-macOS"; @@ -993,7 +993,7 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "SDWebImageSwiftUIDemo-macOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUIDemo-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1030,7 +1030,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 13.0; + TVOS_DEPLOYMENT_TARGET = 14.0; }; name = Debug; }; @@ -1059,7 +1059,7 @@ SDKROOT = appletvos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 13.0; + TVOS_DEPLOYMENT_TARGET = 14.0; }; name = Release; }; diff --git a/SDWebImageSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SDWebImageSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 03bf90e..0000000 --- a/SDWebImageSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,16 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "ViewInspector", - "repositoryURL": "https://github.com/nalexn/ViewInspector.git", - "state": { - "branch": null, - "revision": "7d55eb940242512aad2bf28db354d09d5de43893", - "version": "0.3.11" - } - } - ] - }, - "version": 1 -} diff --git a/carthage.sh b/carthage.sh index 4e004da..04be82b 100755 --- a/carthage.sh +++ b/carthage.sh @@ -2,18 +2,16 @@ # Usage example: ./carthage.sh build --platform iOS set -euo pipefail - + xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) trap 'rm -f "$xcconfig"' INT TERM HUP EXIT - + # For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise # the build will fail on lipo due to duplicate architectures. -CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3) -echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig - -echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig -echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig +echo 'EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig +echo 'EXCLUDED_ARCHS[sdk=appletvsimulator*] = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig +echo 'EXCLUDED_ARCHS[sdk=watchsimulator*] = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig export XCODE_XCCONFIG_FILE="$xcconfig" carthage "$@" \ No newline at end of file