Переглянути джерело

Update CI and build script for single target

onevcat 6 роки тому
батько
коміт
831e54a061

+ 12 - 12
.travis.yml

@@ -5,15 +5,15 @@ osx_image:
 - xcode10.2
 
 env:
-- SCHEME=Kingfisher SWIFT_VERSION=5.0
-- SCHEME=Kingfisher-macOS SWIFT_VERSION=5.0
-- SCHEME=Kingfisher-tvOS SWIFT_VERSION=5.0
-- SCHEME=Kingfisher SWIFT_VERSION=4.2
-- SCHEME=Kingfisher-macOS SWIFT_VERSION=4.2
-- SCHEME=Kingfisher-tvOS SWIFT_VERSION=4.2
-- SCHEME=Kingfisher SWIFT_VERSION=4.0
-- SCHEME=Kingfisher-macOS SWIFT_VERSION=4.0
-- SCHEME=Kingfisher-tvOS SWIFT_VERSION=4.0
+- DESTINATION='platform=macOS' SWIFT_VERSION=5.0
+- DESTINATION='platform=iOS Simulator,name=iPhone 6S' SWIFT_VERSION=5.0
+- DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' SWIFT_VERSION=5.0
+- DESTINATION='platform=macOS' SWIFT_VERSION=4.2
+- DESTINATION='platform=iOS Simulator,name=iPhone 6S' SWIFT_VERSION=4.2
+- DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' SWIFT_VERSION=4.2
+- DESTINATION='platform=macOS' SWIFT_VERSION=4.0
+- DESTINATION='platform=iOS Simulator,name=iPhone 6S' SWIFT_VERSION=4.0
+- DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' SWIFT_VERSION=4.0
 
 cache: bundler
 
@@ -24,11 +24,11 @@ before_install:
 matrix:
   exclude:
   - osx_image: xcode10.1
-    env: SCHEME=Kingfisher SWIFT_VERSION=5.0
+    env: DESTINATION='platform=macOS' SWIFT_VERSION=5.0
   - osx_image: xcode10.1
-    env: SCHEME=Kingfisher-macOS SWIFT_VERSION=5.0
+    env: DESTINATION='platform=iOS Simulator,name=iPhone 6S' SWIFT_VERSION=5.0
   - osx_image: xcode10.1
-    env: SCHEME=Kingfisher-tvOS SWIFT_VERSION=5.0
+    env: DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' SWIFT_VERSION=5.0
 
 script:
   - bundle exec fastlane test_ci

+ 2 - 0
Kingfisher.xcodeproj/project.pbxproj

@@ -85,6 +85,7 @@
 		D16FEA5223078C63006E67D5 /* LSHTTPRequestDSLRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = D16FEA3423078C63006E67D5 /* LSHTTPRequestDSLRepresentation.m */; };
 		D16FEA5323078C63006E67D5 /* LSStubResponseDSL.m in Sources */ = {isa = PBXBuildFile; fileRef = D16FEA3623078C63006E67D5 /* LSStubResponseDSL.m */; };
 		D16FEA5423078C63006E67D5 /* LSStubRequestDSL.m in Sources */ = {isa = PBXBuildFile; fileRef = D16FEA3723078C63006E67D5 /* LSStubRequestDSL.m */; };
+		D16FEA5523079707006E67D5 /* NSButtonExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 185218B51CC07F8300BD58DE /* NSButtonExtensionTests.swift */; };
 		D1839845216E333E003927D3 /* Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1839844216E333E003927D3 /* Delegate.swift */; };
 		D186696D21834261002B502E /* ImageDrawingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D186696C21834261002B502E /* ImageDrawingTests.swift */; };
 		D1A1CC9A219FAB4B00263AD8 /* Source.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A1CC99219FAB4B00263AD8 /* Source.swift */; };
@@ -821,6 +822,7 @@
 				D16FEA3C23078C63006E67D5 /* LSStubRequest.m in Sources */,
 				D12E0C521C47F23500AC98AD /* ImageExtensionTests.swift in Sources */,
 				D16FEA5123078C63006E67D5 /* NSData+Nocilla.m in Sources */,
+				D16FEA5523079707006E67D5 /* NSButtonExtensionTests.swift in Sources */,
 				D16FEA5023078C63006E67D5 /* NSString+Nocilla.m in Sources */,
 				D16FEA4E23078C63006E67D5 /* LSRegexMatcher.m in Sources */,
 				F72CE9CE1FCF17ED00CC522A /* ImageModifierTests.swift in Sources */,

+ 2 - 0
Tests/KingfisherTests/NSButtonExtensionTests.swift

@@ -24,6 +24,7 @@
 //  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 //  THE SOFTWARE.
 
+#if canImport(AppKit)
 import AppKit
 import XCTest
 @testable import Kingfisher
@@ -190,3 +191,4 @@ class NSButtonExtensionTests: XCTestCase {
     }
 
 }
+#endif

+ 16 - 15
fastlane/Fastfile

@@ -6,17 +6,17 @@ default_platform :ios
 platform :ios do
   desc "Runs all the tests"
   lane :tests do
-    test(scheme: "Kingfisher", swift_version: "5.0")
-    test(scheme: "Kingfisher-macOS", swift_version: "5.0")
-    test(scheme: "Kingfisher-tvOS", swift_version: "5.0")
+    test(destination: "platform=macOS", swift_version: "5.0")
+    test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "5.0")
+    test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "5.0")
 
-    test(scheme: "Kingfisher", swift_version: "4.2")
-    test(scheme: "Kingfisher-macOS", swift_version: "4.2")
-    test(scheme: "Kingfisher-tvOS", swift_version: "4.2")
+    test(destination: "platform=macOS", swift_version: "4.2")
+    test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.2")
+    test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.2")
 
-    test(scheme: "Kingfisher", swift_version: "4.0")
-    test(scheme: "Kingfisher-macOS", swift_version: "4.0")
-    test(scheme: "Kingfisher-tvOS", swift_version: "4.0")
+    test(destination: "platform=macOS", swift_version: "4.0")
+    test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.0")
+    test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.0")
   end
 
   lane :test do |options|
@@ -24,15 +24,16 @@ platform :ios do
   end
 
   private_lane :_test do |options|
-    if options[:scheme].include? "macOS"
-        scan(scheme: options[:scheme], clean: true, xcargs: "SWIFT_VERSION=#{options[:swift_version]}", destination: "platform=macOS")
-    else
-        scan(scheme: options[:scheme], clean: true, xcargs: "SWIFT_VERSION=#{options[:swift_version]}")
-    end
+    scan(
+        scheme: "Kingfisher", 
+        clean: true, 
+        xcargs: "SWIFT_VERSION=#{options[:swift_version]}",
+        destination: options[:destination]
+    )
   end
 
   lane :test_ci do
-    test(scheme: ENV["SCHEME"], swift_version: ENV["SWIFT_VERSION"])
+    test(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"])
   end
   
   desc "Lint"