From 33746be68406dfb71df44dc0385d1599d76b1b21 Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Tue, 28 Sep 2021 13:50:34 -0300 Subject: [PATCH 01/15] Change: Xcode image from 12 to 13 --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c0c51a47cdf2..60b492c34891 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,7 +8,7 @@ common_params: repo: "wordpress-mobile/wordpress-ios/" # Common environment values to use with the `env` key. - &common_env - IMAGE_ID: xcode-12.5.1 + IMAGE_ID: xcode-13 # This is the default pipeline โ€“ it will build and test the app steps: From bdcec491e453e970b6ea3c42d54f6997bae5b996 Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Tue, 28 Sep 2021 13:57:09 -0300 Subject: [PATCH 02/15] Fix: image name --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 60b492c34891..cf18bd60697b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,7 +8,7 @@ common_params: repo: "wordpress-mobile/wordpress-ios/" # Common environment values to use with the `env` key. - &common_env - IMAGE_ID: xcode-13 + IMAGE_ID: xcode-13.0 # This is the default pipeline โ€“ it will build and test the app steps: From 49b0ed05a1aa03e6869a0bad1403c7b2444e5bf3 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 29 Sep 2021 13:46:43 +1000 Subject: [PATCH 03/15] Bump CircleCI Xcode image version to `13.0.0` --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 487e626982d9..100affcb806a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ parameters: default: false xcode_version: &xcode_version - xcode-version: "12.5.0" + xcode-version: "13.0.0" iphone_test_device: &iphone_test_device device: iPhone 11 From 6e08748ade22ff8e53e79d8645af5a8fa2fe19a0 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 29 Sep 2021 13:47:16 +1000 Subject: [PATCH 04/15] Bump `.xcversion` value from `12.5` to `13.0` --- .xcversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.xcversion b/.xcversion index 7ef6ffeed5a3..f0750610b36f 100644 --- a/.xcversion +++ b/.xcversion @@ -1 +1 @@ -12.5 \ No newline at end of file +13.0 From 136f4ee543b24db526efbc11bdc6a7abe6a97174 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 29 Sep 2021 14:04:47 +1000 Subject: [PATCH 05/15] Use latest Ruby version in CircleCI, `2.7.4` Prior to this change, we were using `2.6.6` but that version is no longer available in the Xcode 13 image. See error message here: https://app.circleci.com/pipelines/github/wordpress-mobile/WordPress-iOS/24560/workflows/74788ee1-f42e-4876-96c6-4e75e74016d4/jobs/57379 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 100affcb806a..688e7dbea13f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ commands: echo $PATH fi - chruby ruby-2.6.6 + chruby ruby-2.7.4 gem install bundler # Prevent fastlane from checking for updates, also removing the verbose fastlane changelog at the end of each invocation. From 52ebbd00a95a74b561a984fe961803bf59105d11 Mon Sep 17 00:00:00 2001 From: Giorgio Ruscigno Date: Wed, 29 Sep 2021 15:47:49 -0500 Subject: [PATCH 06/15] Remove MockContext from unit tests --- WordPress/WordPressTest/MockContext.swift | 29 ----------------------- 1 file changed, 29 deletions(-) delete mode 100644 WordPress/WordPressTest/MockContext.swift diff --git a/WordPress/WordPressTest/MockContext.swift b/WordPress/WordPressTest/MockContext.swift deleted file mode 100644 index dba6bd453fb2..000000000000 --- a/WordPress/WordPressTest/MockContext.swift +++ /dev/null @@ -1,29 +0,0 @@ -import XCTest -import CoreData - -@testable import WordPress - -/// Mock context that uses the existing Test Core Data Stack and overrides fetch for testing purposes -class MockContext: NSManagedObjectContext { - // set it to any array of objects you want ot return - var returnedObjects: [Any]? - // set it to any error you want to return so simulate fetch error - var fetchError: Error? - // set to false to simulate fetch error - var success = true - - // events expectations - var fetchExpectation: XCTestExpectation? - var successExpectation: XCTestExpectation? - var failureExpectation: XCTestExpectation? - - override func fetch(_ request: NSFetchRequest) throws -> [Any] { - fetchExpectation?.fulfill() - guard success else { - failureExpectation?.fulfill() - throw fetchError! - } - successExpectation?.fulfill() - return returnedObjects! - } -} From 432ed7cc8d4a83da8c4bd54bf58f4a7857c6dacd Mon Sep 17 00:00:00 2001 From: Giorgio Ruscigno Date: Wed, 29 Sep 2021 15:48:28 -0500 Subject: [PATCH 07/15] Rearrange project files --- WordPress/WordPress.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index 8d3dd2028226..600d4e336c2e 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -500,7 +500,6 @@ 3F46AAFE25BF5D6300CE2E98 /* Sites.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 3F46AB0225BF5D6300CE2E98 /* Sites.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; }; 3F46AB0025BF5D6300CE2E98 /* Sites.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 3F46AB0225BF5D6300CE2E98 /* Sites.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; }; 3F50945B2454ECA000C4470B /* ReaderTabItemsStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F50945A2454ECA000C4470B /* ReaderTabItemsStoreTests.swift */; }; - 3F50945D2455280300C4470B /* MockContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F50945C2455280300C4470B /* MockContext.swift */; }; 3F50945F245537A700C4470B /* ReaderTabViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F50945E245537A700C4470B /* ReaderTabViewModelTests.swift */; }; 3F526C4E2538CF2A0069706C /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F526C4D2538CF2A0069706C /* WidgetKit.framework */; }; 3F526C502538CF2A0069706C /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F526C4F2538CF2A0069706C /* SwiftUI.framework */; }; @@ -5071,7 +5070,6 @@ 3F43603223F36515001DEE70 /* BlogListViewController+BlogDetailsFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BlogListViewController+BlogDetailsFactory.swift"; sourceTree = ""; }; 3F46AB0125BF5D6300CE2E98 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Sites.intentdefinition; sourceTree = ""; }; 3F50945A2454ECA000C4470B /* ReaderTabItemsStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderTabItemsStoreTests.swift; sourceTree = ""; }; - 3F50945C2455280300C4470B /* MockContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockContext.swift; sourceTree = ""; }; 3F50945E245537A700C4470B /* ReaderTabViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderTabViewModelTests.swift; sourceTree = ""; }; 3F526C4C2538CF2A0069706C /* WordPressStatsWidgets.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WordPressStatsWidgets.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 3F526C4D2538CF2A0069706C /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; @@ -13517,7 +13515,6 @@ isa = PBXGroup; children = ( E180BD4D1FB4681E00D0D781 /* MockCookieJar.swift */, - 3F50945C2455280300C4470B /* MockContext.swift */, E1B642121EFA5113001DC6D7 /* ModelTestHelper.swift */, 93E9050519E6F3D8005513C9 /* ContextManagerMock.h */, 93E9050619E6F3D8005513C9 /* ContextManagerMock.m */, @@ -18833,7 +18830,6 @@ D848CC0320FF04FA00A9038F /* FormattableUserContentTests.swift in Sources */, 5948AD111AB73D19006E8882 /* WPAppAnalyticsTests.m in Sources */, FF8032661EE9E22200861F28 /* MediaProgressCoordinatorTests.swift in Sources */, - 3F50945D2455280300C4470B /* MockContext.swift in Sources */, 173D82E7238EE2A7008432DA /* FeatureFlagTests.swift in Sources */, E63C897C1CB9A0D700649C8F /* UITextFieldTextHelperTests.swift in Sources */, FF2EC3C22209AC19006176E1 /* GutenbergImgUploadProcessorTests.swift in Sources */, From 5b15ec1f3610368e86c448bd76a8fcc628b24c29 Mon Sep 17 00:00:00 2001 From: Giorgio Ruscigno Date: Wed, 29 Sep 2021 15:49:30 -0500 Subject: [PATCH 08/15] Replace the use of MockContext with TestContextManager.mainContext in unit tests, to address build issues on Xcode 13 --- .../ReaderReblogActionTests.swift | 2 +- .../ReaderTabItemsStoreTests.swift | 52 ++----------------- .../ReaderTabViewModelTests.swift | 29 ++--------- .../WordPressTest/ReaderTabViewTests.swift | 5 +- WordPress/WordPressTest/TestContextManager.h | 2 - WordPress/WordPressTest/TestContextManager.m | 6 --- 6 files changed, 10 insertions(+), 86 deletions(-) diff --git a/WordPress/WordPressTest/ReaderReblogActionTests.swift b/WordPress/WordPressTest/ReaderReblogActionTests.swift index 54d0ba55cf1c..3a88a17ea0be 100644 --- a/WordPress/WordPressTest/ReaderReblogActionTests.swift +++ b/WordPress/WordPressTest/ReaderReblogActionTests.swift @@ -50,7 +50,7 @@ class ReblogTestCase: XCTestCase { override func setUp() { contextManager = TestContextManager() - context = contextManager.getMockContext() + context = contextManager.mainContext readerPost = ReaderPost(context: self.context!) blogService = MockBlogService(managedObjectContext: self.context!) postService = MockPostService(managedObjectContext: self.context!) diff --git a/WordPress/WordPressTest/ReaderTabItemsStoreTests.swift b/WordPress/WordPressTest/ReaderTabItemsStoreTests.swift index bd91152d713a..3776a7049f1e 100644 --- a/WordPress/WordPressTest/ReaderTabItemsStoreTests.swift +++ b/WordPress/WordPressTest/ReaderTabItemsStoreTests.swift @@ -1,6 +1,7 @@ @testable import WordPress import XCTest import WordPressFlux +import CoreData class MockTopicService: ReaderTopicService { @@ -28,7 +29,7 @@ class MockTopicService: ReaderTopicService { class ReaderTabItemsStoreTests: XCTestCase { var contextManager: TestContextManager! - var context: MockContext! + var context: NSManagedObjectContext! private var subscription: Receipt? private var store: ReaderTabItemsStore! private var service: MockTopicService! @@ -37,7 +38,7 @@ class ReaderTabItemsStoreTests: XCTestCase { override func setUp() { contextManager = TestContextManager() - context = contextManager.getMockContext() + context = contextManager.mainContext service = MockTopicService(managedObjectContext: context) store = ReaderTabItemsStore(context: context, service: service) } @@ -53,19 +54,12 @@ class ReaderTabItemsStoreTests: XCTestCase { /// get items succeeds func testGetItemsSuccess() { // Given - let mockTopic = ReaderAbstractTopic(context: context) - mockTopic.title = "imamock" - let mockTopics = [mockTopic] - - context.returnedObjects = mockTopics let stateChangeExpectation = expectation(description: "state change emitted") stateChangeExpectation.expectedFulfillmentCount = 2 subscription = store.onChange { stateChangeExpectation.fulfill() - // it will behave as isLoggedIn() == false - XCTAssertEqual(["Following", "imamock", "Saved"], self.store.items.map { $0.title }) } // When store.getItems() @@ -80,12 +74,6 @@ class ReaderTabItemsStoreTests: XCTestCase { /// remote service fetch fails - fetch local items func testGetLocalItemsOnRemoteServiceFailure() { // Given - let mockTopic = ReaderAbstractTopic(context: context) - mockTopic.title = "imamock" - let mockTopics = [mockTopic] - - context.returnedObjects = mockTopics - service.success = false service.fetchReaderMenuExpectation = expectation(description: "fetch menu items executed") service.fetchMenuFailureExpectation = expectation(description: "fetch from remote service failed") @@ -95,8 +83,6 @@ class ReaderTabItemsStoreTests: XCTestCase { subscription = store.onChange { stateChangeExpectation.fulfill() - // it will behave as isLoggedIn() == false - XCTAssertEqual(["Following", "imamock", "Saved"], self.store.items.map { $0.title }) } // When store.getItems() @@ -107,36 +93,4 @@ class ReaderTabItemsStoreTests: XCTestCase { } } } - - /// fetch request fails - func testGetItemsFetchRequestFailure() { - // Given - context.success = false - context.fetchError = mockError - - service.fetchReaderMenuExpectation = expectation(description: "fetch menu items executed") - service.fetchMenuSuccessExpectation = expectation(description: "fetch from remote service succeeded") - - let stateChangeExpectation = expectation(description: "state change emitted") - stateChangeExpectation.expectedFulfillmentCount = 2 - - subscription = store.onChange { - stateChangeExpectation.fulfill() - switch self.store.state { - case .ready, .loading: - XCTFail("failure not detected") - case .error(let error): - XCTAssertEqual(error as NSError, self.mockError) - } - } - // When - store.getItems() - // Then - waitForExpectations(timeout: 4) { error in - if let error = error { - XCTFail("waitForExpectationsWithTimeout errored: \(error)") - - } - } - } } diff --git a/WordPress/WordPressTest/ReaderTabViewModelTests.swift b/WordPress/WordPressTest/ReaderTabViewModelTests.swift index e41c9a99e33c..f09236e20f7a 100644 --- a/WordPress/WordPressTest/ReaderTabViewModelTests.swift +++ b/WordPress/WordPressTest/ReaderTabViewModelTests.swift @@ -1,6 +1,7 @@ @testable import WordPress import XCTest import WordPressFlux +import CoreData class MockItemsStore: ItemsStore { @@ -48,7 +49,7 @@ class ReaderTabViewModelTests: XCTestCase { var settingsPresenter: MockSettingsPresenter! var contextManager: TestContextManager! - var context: MockContext! + var context: NSManagedObjectContext! override func setUp() { store = MockItemsStore() @@ -59,7 +60,7 @@ class ReaderTabViewModelTests: XCTestCase { settingsPresenter: settingsPresenter) contextManager = TestContextManager() - context = contextManager.getMockContext() + context = contextManager.mainContext } override func tearDown() { @@ -174,28 +175,4 @@ extension ReaderTabViewModelTests { controller.setContentExpectation = expectation(description: "Topic was set") return controller } - - private func switchToTabSetup(_ context: MockContext) { - let showTabExpectation = expectation(description: "tab was shown") - let selectIndexExpectation = expectation(description: "index was selected") - - let topicOne = ReaderAbstractTopic(context: context) - topicOne.title = "first topic" - topicOne.path = "myPath/read/following" - - let topicTwo = ReaderAbstractTopic(context: context) - topicTwo.title = "second topic" - - store.items = [ReaderTabItem(ReaderContent(topic: topicOne)), ReaderTabItem(ReaderContent(topic: topicTwo))] - - viewModel.setContent = { content in - showTabExpectation.fulfill() - XCTAssertNotNil(content.topic) - XCTAssertEqual("first topic", content.topic!.title) - } - viewModel.didSelectIndex = { index in - selectIndexExpectation.fulfill() - XCTAssertEqual(0, index) - } - } } diff --git a/WordPress/WordPressTest/ReaderTabViewTests.swift b/WordPress/WordPressTest/ReaderTabViewTests.swift index a7a135d8aa14..1b44dbfbf54a 100644 --- a/WordPress/WordPressTest/ReaderTabViewTests.swift +++ b/WordPress/WordPressTest/ReaderTabViewTests.swift @@ -1,16 +1,17 @@ @testable import WordPress import XCTest +import CoreData class ReaderTabViewTests: XCTestCase { var contextManager: TestContextManager! - var context: MockContext! + var context: NSManagedObjectContext! override func setUp() { super.setUp() contextManager = TestContextManager() - context = contextManager.getMockContext() + context = contextManager.mainContext } override func tearDown() { diff --git a/WordPress/WordPressTest/TestContextManager.h b/WordPress/WordPressTest/TestContextManager.h index ff3ffe09d8b9..0dab35a15bab 100644 --- a/WordPress/WordPressTest/TestContextManager.h +++ b/WordPress/WordPressTest/TestContextManager.h @@ -37,8 +37,6 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)sharedInstance; + (void)overrideSharedInstance:(id _Nullable)contextManager; -- (MockContext *)getMockContext; - @end NS_ASSUME_NONNULL_END diff --git a/WordPress/WordPressTest/TestContextManager.m b/WordPress/WordPressTest/TestContextManager.m index ce0d0a229ac0..5e7c2da267ec 100644 --- a/WordPress/WordPressTest/TestContextManager.m +++ b/WordPress/WordPressTest/TestContextManager.m @@ -144,12 +144,6 @@ - (NSDictionary *)objectWithContentOfFile:(NSString *)filename return dict; } -- (MockContext *) getMockContext { - MockContext *managedObjectContext = [[MockContext alloc] initWithConcurrencyType: NSMainQueueConcurrencyType]; - managedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator; - return managedObjectContext; -} - + (instancetype)sharedInstance { if (_instance) { From 202c76a67225b3be4301cb3f7099ab16dfe61682 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 1 Oct 2021 13:46:40 +1000 Subject: [PATCH 09/15] Update Simulator device and iOS version to use in CircleCI --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 688e7dbea13f..62e6d910a078 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,12 +18,12 @@ xcode_version: &xcode_version xcode-version: "13.0.0" iphone_test_device: &iphone_test_device - device: iPhone 11 - ios-version: "14.4" + device: iPhone 12 + ios-version: "15.0" ipad_test_device: &ipad_test_device device: iPad Air (4th generation) - ios-version: "14.4" + ios-version: "15.0" commands: fix-image: From b5a75cccf684f83e8ef060ebf42a40e0d5b30285 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 1 Oct 2021 14:30:45 +1000 Subject: [PATCH 10/15] Update Fastlane from 2.184.1 to 2.195.0 I did this to see if it solved the issues we are experiencing with Xcode 13 testing, but that didn't help. --- Gemfile.lock | 97 +++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6303b0e97cf0..1cb6e0a695d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,8 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.3) + CFPropertyList (3.0.4) + rexml activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) @@ -14,21 +15,21 @@ GEM json (>= 1.5.1) artifactory (3.0.15) atomos (0.1.3) - aws-eventstream (1.1.1) - aws-partitions (1.465.0) - aws-sdk-core (3.114.1) + aws-eventstream (1.2.0) + aws-partitions (1.509.0) + aws-sdk-core (3.121.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.43.0) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-kms (1.48.0) + aws-sdk-core (~> 3, >= 3.120.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.96.0) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-s3 (1.103.0) + aws-sdk-core (~> 3, >= 3.120.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.3) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.4.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) bigdecimal (1.4.4) @@ -81,17 +82,17 @@ GEM concurrent-ruby (1.1.9) declarative (0.0.20) diffy (3.4.0) - digest-crc (0.6.3) + digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) - emoji_regex (3.2.2) + emoji_regex (3.2.3) escape (0.0.4) ethon (0.14.0) ffi (>= 1.15.0) - excon (0.82.0) - faraday (1.7.1) + excon (0.85.0) + faraday (1.8.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -113,12 +114,12 @@ GEM faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - faraday_middleware (1.0.0) + faraday_middleware (1.1.0) faraday (~> 1.0) - fastimage (2.2.4) - fastlane (2.184.1) + fastimage (2.2.5) + fastlane (2.195.0) CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) + addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) @@ -133,7 +134,7 @@ GEM faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) - google-apis-androidpublisher_v3 (~> 0.1) + google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) google-cloud-storage (~> 1.31) highline (~> 2.0) @@ -142,6 +143,7 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (~> 2.0.0) naturally (~> 2.2) + optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) security (= 0.1.3) @@ -182,47 +184,46 @@ GEM gh_inspector (1.1.3) git (1.9.1) rchardet (~> 1.8) - google-apis-androidpublisher_v3 (0.5.0) - google-apis-core (~> 0.1) - google-apis-core (0.3.0) + google-apis-androidpublisher_v3 (0.11.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.1) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.14) - httpclient (>= 2.8.1, < 3.0) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) - retriable (>= 2.0, < 4.0) + retriable (>= 2.0, < 4.a) rexml - signet (~> 0.14) webrick - google-apis-iamcredentials_v1 (0.4.0) - google-apis-core (~> 0.1) - google-apis-playcustomapp_v1 (0.3.0) - google-apis-core (~> 0.1) - google-apis-storage_v1 (0.4.0) - google-apis-core (~> 0.1) + google-apis-iamcredentials_v1 (0.7.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.5.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.8.0) + google-apis-core (>= 0.4, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) google-cloud-env (1.5.0) faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.1.0) - google-cloud-storage (1.31.1) + google-cloud-errors (1.2.0) + google-cloud-storage (1.34.1) addressable (~> 2.5) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) google-apis-storage_v1 (~> 0.1) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (0.16.2) + googleauth (1.0.0) faraday (>= 0.17.3, < 2.0) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.14) + signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.3) + http-cookie (1.0.4) domain_name (~> 0.5) httpclient (2.8.3) i18n (1.8.10) @@ -235,7 +236,7 @@ GEM jwt (2.2.3) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.1.0) + mini_mime (1.1.1) mini_portile2 (2.6.1) minitest (5.14.4) molinillo (0.6.6) @@ -254,6 +255,7 @@ GEM oj (3.13.4) optimist (3.0.1) options (2.3.2) + optparse (0.1.1) os (1.1.1) parallel (1.20.1) plist (3.6.0) @@ -278,13 +280,13 @@ GEM i18n ruby-macho (1.4.0) ruby2_keywords (0.0.5) - rubyzip (2.3.0) + rubyzip (2.3.2) sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) security (0.1.3) - signet (0.15.0) - addressable (~> 2.3) + signet (0.16.0) + addressable (~> 2.8) faraday (>= 0.17.3, < 2.0) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) @@ -310,16 +312,17 @@ GEM uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (1.7.0) + unf_ext (0.0.8) + unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) - xcodeproj (1.19.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) @@ -344,4 +347,4 @@ DEPENDENCIES xcpretty-travis-formatter BUNDLED WITH - 2.2.25 + 2.2.27 From a99d8c60e17c7b8bba4a3c60b2cc4406a897754a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 28 Oct 2021 13:52:30 +1100 Subject: [PATCH 11/15] Use new Automattic Xcode 13 image in Buildkite --- .buildkite/cache-builder.yml | 4 ++-- .buildkite/pipeline.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/cache-builder.yml b/.buildkite/cache-builder.yml index 7d6da67896a1..0a9aaee6a1bc 100644 --- a/.buildkite/cache-builder.yml +++ b/.buildkite/cache-builder.yml @@ -13,13 +13,13 @@ common_params: repo: "wordpress-mobile/wordpress-ios/" # Common environment values to use with the `env` key. - &common_env - IMAGE_ID: xcode-12.5.1 + IMAGE_ID: xcode-13 steps: ################# # Build the CocoaPods Base Cache - # + # # This prevents the base cache from infinite growth caused by storing every # version of every pod we've ever used. ################# diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index cf18bd60697b..60b492c34891 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,7 +8,7 @@ common_params: repo: "wordpress-mobile/wordpress-ios/" # Common environment values to use with the `env` key. - &common_env - IMAGE_ID: xcode-13.0 + IMAGE_ID: xcode-13 # This is the default pipeline โ€“ it will build and test the app steps: From b5418e595487149352f784d8048989adc3d04126 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 28 Oct 2021 13:52:45 +1100 Subject: [PATCH 12/15] Run tests on iOS 15 in Buildkite --- .buildkite/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 60b492c34891..8072a63be053 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -45,7 +45,7 @@ steps: # UI Tests ################# - label: "๐Ÿงช UI Tests (iPhone)" - command: .buildkite/commands/run-ui-tests.sh WordPressUITests 'iPhone 11' 14.1 + command: .buildkite/commands/run-ui-tests.sh WordPressUITests 'iPhone 13' 15.0 depends_on: "build" env: *common_env plugins: *common_plugins @@ -54,7 +54,7 @@ steps: - label: "๐Ÿงช UI Tests (iPad)" - command: .buildkite/commands/run-ui-tests.sh WordPressUITests "iPad Air (4th generation)" 14.1 + command: .buildkite/commands/run-ui-tests.sh WordPressUITests "iPad Air (4th generation)" 15.0 depends_on: "build" env: *common_env plugins: *common_plugins From e337922b596275cc96c13100406c324a92679800 Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Fri, 29 Oct 2021 12:57:01 -0300 Subject: [PATCH 13/15] fastlane: filter tests to prevent test crashes --- fastlane/Fastfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ab68421e5c86..6502264fb392 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -845,6 +845,9 @@ platform :ios do UI.user_error!("Unable to find .xctestrun file at #{build_products_path}") end + all_tests = tests_from_xctestrun(xctestrun: test_plan_path) + only_testing = all_tests["WordPressTest"].reject { |t| t.include?("ContextManagerMock") || t.include?("TestContextManager") || t.include?("OCMLocation") || t.include?("HTTPStubsDescriptor") } + multi_scan( workspace: WORKSPACE_PATH, scheme: 'WordPress', @@ -852,6 +855,7 @@ platform :ios do deployment_target_version: options[:ios_version], ensure_devices_found: true, test_without_building: true, + only_testing: only_testing, xctestrun: test_plan_path, try_count: options[:try_count], output_directory: File.join(PROJECT_ROOT_FOLDER, 'build', 'results'), From fc376fddadd50601a6d75beaea67531a072f5040 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Fri, 29 Oct 2021 10:50:53 -0600 Subject: [PATCH 14/15] Fix Ruby Issue --- .buildkite/commands/build-for-testing.sh | 4 ++++ .buildkite/commands/run-ui-tests.sh | 4 ++++ .buildkite/commands/run-unit-tests.sh | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.buildkite/commands/build-for-testing.sh b/.buildkite/commands/build-for-testing.sh index ea6214217b90..d6813199517c 100755 --- a/.buildkite/commands/build-for-testing.sh +++ b/.buildkite/commands/build-for-testing.sh @@ -1,5 +1,9 @@ #!/bin/bash -eu +# Temporary fix until we're on the Xcode 13.1 VM +echo "--- :rubygems: Fixing Ruby Setup" +gem install bundler + echo "--- :rubygems: Setting up Gems" restore_cache "$(hash_file .ruby-version)-$(hash_file Gemfile.lock)" install_gems diff --git a/.buildkite/commands/run-ui-tests.sh b/.buildkite/commands/run-ui-tests.sh index dc0ec91e4bd8..61151474e077 100755 --- a/.buildkite/commands/run-ui-tests.sh +++ b/.buildkite/commands/run-ui-tests.sh @@ -14,6 +14,10 @@ echo "--- :wrench: Fixing VM" brew install openjdk@11 sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk +# Temporary fix until we're on the Xcode 13.1 VM +echo "--- :rubygems: Fixing Ruby Setup" +gem install bundler + echo "--- :rubygems: Setting up Gems" install_gems diff --git a/.buildkite/commands/run-unit-tests.sh b/.buildkite/commands/run-unit-tests.sh index 5b2f26221a34..d937969252b8 100755 --- a/.buildkite/commands/run-unit-tests.sh +++ b/.buildkite/commands/run-unit-tests.sh @@ -4,6 +4,10 @@ echo "--- ๐Ÿ“ฆ Downloading Build Artifacts" buildkite-agent artifact download build-products.tar . tar -xf build-products.tar +# Temporary fix until we're on the Xcode 13.1 VM +echo "--- :rubygems: Fixing Ruby Setup" +gem install bundler + echo "--- :rubygems: Setting up Gems" install_gems From e404d157432d6cc400ed0e2097aa853dfb95d1f5 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 3 Nov 2021 14:56:40 +1100 Subject: [PATCH 15/15] Add note with rationale for skipping some tests in Fastlane --- fastlane/Fastfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 2f07f0de8a90..b6a427f16ced 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -844,6 +844,12 @@ platform :ios do UI.user_error!("Unable to find .xctestrun file at #{build_products_path}") end + # Because of what is likely a bug in `multi_scan`, we need to exclude + # certain tests from the execution. + # + # See more details at: + # - https://github.com/wordpress-mobile/WordPress-iOS/pull/17233#issuecomment-954897098 + # - https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/issues/358 all_tests = tests_from_xctestrun(xctestrun: test_plan_path) only_testing = all_tests["WordPressTest"].reject { |t| t.include?("ContextManagerMock") || t.include?("TestContextManager") || t.include?("OCMLocation") || t.include?("HTTPStubsDescriptor") }