diff --git a/.buildkite/build-and-test.sh b/.buildkite/build-and-test.sh new file mode 100755 index 000000000..acf936a5d --- /dev/null +++ b/.buildkite/build-and-test.sh @@ -0,0 +1,10 @@ +#!/bin/bash -eu + +# We need to use a script as opposed to calling `build_and_test_pod` inline in +# the pipeline via the `command` node because our CI-VM setup doesn't forward +# the environment in that mode. + +# See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 +gem install bundler + +build_and_test_pod diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 23cadc67e..1fc35c41a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -3,7 +3,7 @@ common_params: plugins: &common_plugins - &bash_cache automattic/bash-cache#2.0.0: ~ env: &common_env - IMAGE_ID: xcode-13 + IMAGE_ID: xcode-13.4.1 # This is the default pipeline – it will build and test the pod steps: @@ -12,10 +12,7 @@ steps: ################# - label: "🧪 Build and Test" key: "test" - command: | - # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 - gem install bundler:2.3.4 - build_and_test_pod + command: .buildkite/build-and-test.sh env: *common_env plugins: *common_plugins @@ -26,7 +23,7 @@ steps: key: "validate" command: | # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 - gem install bundler:2.3.4 + gem install bundler validate_podspec env: *common_env plugins: *common_plugins @@ -38,7 +35,7 @@ steps: key: "lint" command: | # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 - gem install bundler:2.3.4 + gem install bundler lint_pod env: *common_env plugins: *common_plugins diff --git a/WordPressAuthenticator.xcodeproj/project.pbxproj b/WordPressAuthenticator.xcodeproj/project.pbxproj index f1947d3a3..978c69f63 100644 --- a/WordPressAuthenticator.xcodeproj/project.pbxproj +++ b/WordPressAuthenticator.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 48; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -11,6 +11,7 @@ 1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */; }; 1A4095182271AEFC009AA86D /* WPAuthenticator-Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3108613125AFA4830022F75E /* PasteboardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3108613025AFA4830022F75E /* PasteboardTests.swift */; }; + 3F338B6A289B877F0014ADC5 /* BuildkiteTestCollector in Frameworks */ = {isa = PBXBuildFile; productRef = 3F338B69289B877F0014ADC5 /* BuildkiteTestCollector */; }; 3F550D4E23DA429B007E5897 /* AppSelectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F550D4D23DA429B007E5897 /* AppSelectorTests.swift */; }; 3F550D5123DA4A9C007E5897 /* LinkMailPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F550D5023DA4A9C007E5897 /* LinkMailPresenter.swift */; }; 3F550D5323DA4AC6007E5897 /* URLHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F550D5223DA4AC6007E5897 /* URLHandler.swift */; }; @@ -212,6 +213,7 @@ 3108613025AFA4830022F75E /* PasteboardTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardTests.swift; sourceTree = ""; }; 33FEF45B466FF8EAAE5F3923 /* Pods-WordPressAuthenticator.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release.xcconfig"; sourceTree = ""; }; 37AFD4EF492B00CA7AEC11A3 /* Pods-WordPressAuthenticatorTests.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.release-alpha.xcconfig"; sourceTree = ""; }; + 3F338B6B289B87E60014ADC5 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; 3F550D4D23DA429B007E5897 /* AppSelectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSelectorTests.swift; sourceTree = ""; }; 3F550D5023DA4A9C007E5897 /* LinkMailPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkMailPresenter.swift; sourceTree = ""; }; 3F550D5223DA4AC6007E5897 /* URLHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLHandler.swift; sourceTree = ""; }; @@ -402,6 +404,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3F338B6A289B877F0014ADC5 /* BuildkiteTestCollector in Frameworks */, B5ED78FE207E976500A8FD8C /* WordPressAuthenticator.framework in Frameworks */, E8AF6B9EF50902F2117DFAF9 /* Pods_WordPressAuthenticatorTests.framework in Frameworks */, ); @@ -770,6 +773,7 @@ B501C03F208FC52500D1E58F /* Services */, 3F550D4C23DA4191007E5897 /* UI */, B5ED7904207E976500A8FD8C /* Info.plist */, + 3F338B6B289B87E60014ADC5 /* UnitTests.xctestplan */, ); path = WordPressAuthenticatorTests; sourceTree = ""; @@ -964,9 +968,9 @@ buildConfigurationList = B5ED7908207E976500A8FD8C /* Build configuration list for PBXNativeTarget "WordPressAuthenticator" */; buildPhases = ( 6CD6648B820552D8638F8EDA /* [CP] Check Pods Manifest.lock */, + B5ED78F1207E976500A8FD8C /* Headers */, B5ED78EF207E976500A8FD8C /* Sources */, B5ED78F0207E976500A8FD8C /* Frameworks */, - B5ED78F1207E976500A8FD8C /* Headers */, B5ED78F2207E976500A8FD8C /* Resources */, B5A5274B20B479D30065BE81 /* CopyFiles */, ); @@ -995,6 +999,9 @@ B5ED7900207E976500A8FD8C /* PBXTargetDependency */, ); name = WordPressAuthenticatorTests; + packageProductDependencies = ( + 3F338B69289B877F0014ADC5 /* BuildkiteTestCollector */, + ); productName = WordPressAuthenticatorTests; productReference = B5ED78FD207E976500A8FD8C /* WordPressAuthenticatorTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -1030,6 +1037,9 @@ Base, ); mainGroup = B5ED78EA207E976500A8FD8C; + packageReferences = ( + 3F338B66289B87650014ADC5 /* XCRemoteSwiftPackageReference "test-collector-swift" */, + ); productRefGroup = B5ED78F5207E976500A8FD8C /* Products */; projectDirPath = ""; projectRoot = ""; @@ -1438,7 +1448,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1459,7 +1470,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = WordPressAuthenticator/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 1.21.0; PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -1483,7 +1498,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = WordPressAuthenticator/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 1.21.0; PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -1501,7 +1520,11 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = PZYM8XX95Q; INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h"; @@ -1519,7 +1542,11 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = PZYM8XX95Q; INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h"; @@ -1579,7 +1606,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1600,7 +1628,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = WordPressAuthenticator/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 1.21.0; PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -1618,7 +1650,11 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = PZYM8XX95Q; INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h"; @@ -1678,7 +1714,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1699,7 +1736,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = WordPressAuthenticator/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 1.21.0; PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -1717,7 +1758,11 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = PZYM8XX95Q; INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h"; @@ -1764,6 +1809,25 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 3F338B66289B87650014ADC5 /* XCRemoteSwiftPackageReference "test-collector-swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/buildkite/test-collector-swift"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 0.3.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 3F338B69289B877F0014ADC5 /* BuildkiteTestCollector */ = { + isa = XCSwiftPackageProductDependency; + package = 3F338B66289B87650014ADC5 /* XCRemoteSwiftPackageReference "test-collector-swift" */; + productName = BuildkiteTestCollector; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = B5ED78EB207E976500A8FD8C /* Project object */; } diff --git a/WordPressAuthenticator.xcodeproj/xcshareddata/xcschemes/WordPressAuthenticator.xcscheme b/WordPressAuthenticator.xcodeproj/xcshareddata/xcschemes/WordPressAuthenticator.xcscheme index 82d59831e..876572da7 100644 --- a/WordPressAuthenticator.xcodeproj/xcshareddata/xcschemes/WordPressAuthenticator.xcscheme +++ b/WordPressAuthenticator.xcodeproj/xcshareddata/xcschemes/WordPressAuthenticator.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -37,6 +37,12 @@ ReferencedContainer = "container:WordPressAuthenticator.xcodeproj"> + + + + diff --git a/WordPressAuthenticator.xcworkspace/xcshareddata/swiftpm/Package.resolved b/WordPressAuthenticator.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000..777352a57 --- /dev/null +++ b/WordPressAuthenticator.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "test-collector-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/buildkite/test-collector-swift", + "state" : { + "revision" : "77c7f492f5c1c9ca159f73d18f56bbd1186390b0", + "version" : "0.3.0" + } + } + ], + "version" : 2 +} diff --git a/WordPressAuthenticatorTests/UnitTests.xctestplan b/WordPressAuthenticatorTests/UnitTests.xctestplan new file mode 100644 index 000000000..86a7b0cfb --- /dev/null +++ b/WordPressAuthenticatorTests/UnitTests.xctestplan @@ -0,0 +1,63 @@ +{ + "configurations" : [ + { + "id" : "D97A5016-3F23-4D19-9CEB-C10A9AC3591F", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + "environmentVariableEntries" : [ + { + "key" : "BUILDKITE_ANALYTICS_TOKEN", + "value" : "$(BUILDKITE_ANALYTICS_TOKEN)" + }, + { + "key" : "BUILDKITE_BRANCH", + "value" : "$(BUILDKITE_BRANCH)" + }, + { + "key" : "BUILDKITE_BUILD_ID", + "value" : "$(BUILDKITE_BUILD_ID)" + }, + { + "key" : "BUILDKITE_BUILD_NUMBER", + "value" : "$(BUILDKITE_BUILD_NUMBER)" + }, + { + "key" : "BUILDKITE_BUILD_URL", + "value" : "$(BUILDKITE_BUILD_URL)" + }, + { + "key" : "BUILDKITE_COMMIT", + "value" : "$(BUILDKITE_COMMIT)" + }, + { + "key" : "BUILDKITE_JOB_ID", + "value" : "$(BUILDKITE_JOB_ID)" + }, + { + "key" : "BUILDKITE_MESSAGE", + "value" : "$(BUILDKITE_MESSAGE)" + } + ], + "targetForVariableExpansion" : { + "containerPath" : "container:WordPressAuthenticator.xcodeproj", + "identifier" : "B5ED78F3207E976500A8FD8C", + "name" : "WordPressAuthenticator" + }, + "testTimeoutsEnabled" : true + }, + "testTargets" : [ + { + "target" : { + "containerPath" : "container:WordPressAuthenticator.xcodeproj", + "identifier" : "B5ED78FC207E976500A8FD8C", + "name" : "WordPressAuthenticatorTests" + } + } + ], + "version" : 1 +}