diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8f7010f..836fb0b 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -40,18 +40,15 @@ jobs: - name: Install cocoapods dependencies if: steps.cache-pods.outputs.cache-hit != 'true' run: bundle exec pod install + + - name: Build Swift Package + run: swift build -j 2 --disable-index-store -v - name: Test Framework on iOS and tvOS - run: bundle exec fastlane ios test + run: bundle exec fastlane ios test ci:github - name: Test Framework on macOS - run: bundle exec fastlane mac test + run: bundle exec fastlane mac test ci:github - name: Lint podspec run: bundle exec pod lib lint - - - name: Build Swift Package - run: swift build -v - - - name: Test Swift Package - run: swift test -v diff --git a/Gemfile b/Gemfile index ff67d0e..a0469b6 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,6 @@ source "https://rubygems.org" gem "cocoapods", "1.10.1" gem "fastlane", "~> 2.137" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock index 2ecec3b..1ee04c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,6 +70,7 @@ GEM cocoapods-try (1.2.0) colored (1.2) colored2 (3.1.2) + colorize (0.8.1) commander-fastlane (4.4.6) highline (~> 1.7.2) concurrent-ruby (1.1.8) @@ -130,6 +131,13 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-test_center (3.15.3) + colorize + json + plist + trainer + xcodeproj + xctest_list (>= 1.2.1) ffi (1.15.0) fourflusher (2.3.1) fuzzy_match (2.0.4) @@ -209,6 +217,9 @@ GEM terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) + trainer (0.9.1) + fastlane (>= 2.25.0) + plist (>= 3.1.0, < 4.0.0) tty-cursor (0.7.1) tty-screen (0.8.1) tty-spinner (0.9.3) @@ -233,6 +244,7 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.0) xcpretty (~> 0.2, >= 0.0.7) + xctest_list (1.2.1) PLATFORMS ruby @@ -240,6 +252,7 @@ PLATFORMS DEPENDENCIES cocoapods (= 1.10.1) fastlane (~> 2.137) + fastlane-plugin-test_center BUNDLED WITH 1.17.3 diff --git a/IntrospectTests/AppKitTests.swift b/IntrospectTests/AppKitTests.swift index 0d2ce28..e8e41be 100644 --- a/IntrospectTests/AppKitTests.swift +++ b/IntrospectTests/AppKitTests.swift @@ -7,7 +7,7 @@ import SwiftUI @available(macOS 10.15.0, *) enum TestUtils { enum Constants { - static let timeout: TimeInterval = 2 + static let timeout: TimeInterval = 5 } static func present(view: ViewType) { @@ -20,6 +20,7 @@ enum TestUtils { window.setFrameAutosaveName("Main Window") window.contentView = NSHostingView(rootView: view) window.makeKeyAndOrderFront(nil) + window.layoutIfNeeded() } } diff --git a/IntrospectTests/UIKitTests.swift b/IntrospectTests/UIKitTests.swift index 693ccc0..3cc6666 100644 --- a/IntrospectTests/UIKitTests.swift +++ b/IntrospectTests/UIKitTests.swift @@ -28,6 +28,7 @@ enum TestUtils { hostingController.beginAppearanceTransition(true, animated: false) window.rootViewController = hostingController window.makeKeyAndVisible() + window.layoutIfNeeded() hostingController.endAppearanceTransition() } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index de53afa..9a1d09b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -2,23 +2,32 @@ default_platform(:ios) skip_docs platform :ios do - lane :test do - scan( + lane :test do |options| + puts 'Running on GitHub CI.' if options[:ci] == 'github' + multi_scan( devices: ["iPhone 8"], - scheme: "Introspect iOS" + scheme: "Introspect iOS", + skip_build: options[:ci] == 'github', + try_count: 3, + quit_simulators: false ) - scan( + multi_scan( devices: ["Apple TV"], - scheme: "Introspect tvOS" + scheme: "Introspect tvOS", + skip_build: options[:ci] == 'github', + try_count: 3, + quit_simulators: false ) end end platform :mac do - lane :test do + lane :test do |options| + puts 'Running on GitHub CI.' if options[:ci] == 'github' scan( - scheme: "Introspect macOS" + scheme: "Introspect macOS", + skip_build: options[:ci] == 'github' ) end end diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 0000000..139f3a7 --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,5 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-test_center'