From f7c34f627760b735edf2ae8db43515b68e04a8a9 Mon Sep 17 00:00:00 2001 From: Fin Date: Thu, 24 Jun 2021 12:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yaml | 37 +++++ Bark.xcodeproj/project.pbxproj | 133 +++++++++++++++++- .../xcshareddata/xcschemes/Bark.xcscheme | 10 ++ .../NotificationContentExtension.xcscheme | 10 ++ .../NotificationServiceExtension.xcscheme | 10 ++ BarkTests/BarkTests.swift | 33 +++++ BarkTests/Info.plist | 22 +++ fastlane/Fastfile | 6 +- 8 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/tests.yaml create mode 100644 BarkTests/BarkTests.swift create mode 100644 BarkTests/Info.plist diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..30f3316 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,37 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + deploy: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Select Xcode Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.2 + bundler-cache: true + + - name: Install Pods + run: pod install + + - name: Run Tests + run: | + export LC_ALL=en_US.UTF-8 + export LANG=en_US.UTF-8 + bundle exec fastlane tests \ No newline at end of file diff --git a/Bark.xcodeproj/project.pbxproj b/Bark.xcodeproj/project.pbxproj index 45c9429..c919ea5 100644 --- a/Bark.xcodeproj/project.pbxproj +++ b/Bark.xcodeproj/project.pbxproj @@ -103,6 +103,7 @@ 06C595362481160F006B98F3 /* BKLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C595352481160F006B98F3 /* BKLabel.swift */; }; 06CF784721C7A50300A052D7 /* NotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 06CF784C21C7A51200A052D7 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06CF784B21C7A51200A052D7 /* NotificationService.swift */; }; + 06EE1FD326843E9300586708 /* BarkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06EE1FD226843E9300586708 /* BarkTests.swift */; }; 6AF9CC9B5F6CD2BF86509897 /* libPods-Bark.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4EA0C04469BF7B418FF3CB7 /* libPods-Bark.a */; }; ACC117FABC6F8E44060B8D80 /* libPods-NotificationServiceExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A24A28EB12CA35B953807C99 /* libPods-NotificationServiceExtension.a */; }; /* End PBXBuildFile section */ @@ -122,6 +123,13 @@ remoteGlobalIDString = 06CF783F21C7A50300A052D7; remoteInfo = NotificationServiceExtension; }; + 06EE1FD526843E9300586708 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0661A537204FDA4100965E4E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0661A53E204FDA4100965E4E; + remoteInfo = Bark; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -239,6 +247,9 @@ 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 06CF784421C7A50300A052D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 06CF784B21C7A51200A052D7 /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; + 06EE1FD026843E9300586708 /* BarkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BarkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 06EE1FD226843E9300586708 /* BarkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarkTests.swift; sourceTree = ""; }; + 06EE1FD426843E9300586708 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 08AEA046D1FD0D7950208796 /* Pods-NotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationServiceExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NotificationServiceExtension/Pods-NotificationServiceExtension.debug.xcconfig"; sourceTree = ""; }; 14F0F73EC45A35FC2482F967 /* Pods_NotificationContentExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationContentExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1CC985CE300A858FF65E166A /* Pods-Bark.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bark.release.xcconfig"; path = "Pods/Target Support Files/Pods-Bark/Pods-Bark.release.xcconfig"; sourceTree = ""; }; @@ -275,6 +286,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 06EE1FCD26843E9300586708 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -422,6 +440,7 @@ 0661A541204FDA4100965E4E /* Bark */, 0632CE2120EC9098003FDF46 /* NotificationContentExtension */, 06CF784121C7A50300A052D7 /* NotificationServiceExtension */, + 06EE1FD126843E9300586708 /* BarkTests */, 0661A540204FDA4100965E4E /* Products */, 9563D0DB71FE280909AB1C63 /* Pods */, 99BD309BDB7F62B5DC0CECE1 /* Frameworks */, @@ -434,6 +453,7 @@ 0661A53F204FDA4100965E4E /* Bark.app */, 0632CE1E20EC9098003FDF46 /* NotificationContentExtension.appex */, 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */, + 06EE1FD026843E9300586708 /* BarkTests.xctest */, ); name = Products; sourceTree = ""; @@ -461,6 +481,15 @@ path = NotificationServiceExtension; sourceTree = ""; }; + 06EE1FD126843E9300586708 /* BarkTests */ = { + isa = PBXGroup; + children = ( + 06EE1FD226843E9300586708 /* BarkTests.swift */, + 06EE1FD426843E9300586708 /* Info.plist */, + ); + path = BarkTests; + sourceTree = ""; + }; 9563D0DB71FE280909AB1C63 /* Pods */ = { isa = PBXGroup; children = ( @@ -545,13 +574,31 @@ productReference = 06CF784021C7A50300A052D7 /* NotificationServiceExtension.appex */; productType = "com.apple.product-type.app-extension"; }; + 06EE1FCF26843E9300586708 /* BarkTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 06EE1FD726843E9300586708 /* Build configuration list for PBXNativeTarget "BarkTests" */; + buildPhases = ( + 06EE1FCC26843E9300586708 /* Sources */, + 06EE1FCD26843E9300586708 /* Frameworks */, + 06EE1FCE26843E9300586708 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 06EE1FD626843E9300586708 /* PBXTargetDependency */, + ); + name = BarkTests; + productName = BarkTests; + productReference = 06EE1FD026843E9300586708 /* BarkTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0661A537204FDA4100965E4E /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1010; + LastSwiftUpdateCheck = 1250; LastUpgradeCheck = 0930; ORGANIZATIONNAME = Fin; TargetAttributes = { @@ -572,6 +619,11 @@ CreatedOnToolsVersion = 10.1; ProvisioningStyle = Manual; }; + 06EE1FCF26843E9300586708 = { + CreatedOnToolsVersion = 12.5; + ProvisioningStyle = Automatic; + TestTargetID = 0661A53E204FDA4100965E4E; + }; }; }; buildConfigurationList = 0661A53A204FDA4100965E4E /* Build configuration list for PBXProject "Bark" */; @@ -591,6 +643,7 @@ 0661A53E204FDA4100965E4E /* Bark */, 0632CE1D20EC9098003FDF46 /* NotificationContentExtension */, 06CF783F21C7A50300A052D7 /* NotificationServiceExtension */, + 06EE1FCF26843E9300586708 /* BarkTests */, ); }; /* End PBXProject section */ @@ -655,6 +708,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 06EE1FCE26843E9300586708 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -799,6 +859,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 06EE1FCC26843E9300586708 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06EE1FD326843E9300586708 /* BarkTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -812,6 +880,11 @@ target = 06CF783F21C7A50300A052D7 /* NotificationServiceExtension */; targetProxy = 06CF784521C7A50300A052D7 /* PBXContainerItemProxy */; }; + 06EE1FD626843E9300586708 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0661A53E204FDA4100965E4E /* Bark */; + targetProxy = 06EE1FD526843E9300586708 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -1093,6 +1166,55 @@ }; name = Release; }; + 06EE1FD826843E9300586708 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 5U8LBRXG3A; + INFOPLIST_FILE = BarkTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.fin.BarkTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Bark.app/Bark"; + }; + name = Debug; + }; + 06EE1FD926843E9300586708 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 5U8LBRXG3A; + INFOPLIST_FILE = BarkTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.fin.BarkTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Bark.app/Bark"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1132,6 +1254,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 06EE1FD726843E9300586708 /* Build configuration list for PBXNativeTarget "BarkTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06EE1FD826843E9300586708 /* Debug */, + 06EE1FD926843E9300586708 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 0661A537204FDA4100965E4E /* Project object */; diff --git a/Bark.xcodeproj/xcshareddata/xcschemes/Bark.xcscheme b/Bark.xcodeproj/xcshareddata/xcschemes/Bark.xcscheme index 7824f79..6c067bb 100644 --- a/Bark.xcodeproj/xcshareddata/xcschemes/Bark.xcscheme +++ b/Bark.xcodeproj/xcshareddata/xcschemes/Bark.xcscheme @@ -28,6 +28,16 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + + + + + + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 4827480..83b33af 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -40,7 +40,11 @@ platform :ios do upload_to_testflight bark_key = ENV["BARK_KEY"] - %x( curl https://api.day.app/#{bark_key}/Bark%20has%20completed%20processing ) + %x( curl https://api.day.app/#{bark_key}/Bark%20has%20completed%20processing?isArchive=0 ) end + + lane :tests do + run_tests(scheme: "Bark.xcworkspace", scheme: "Bark") + end end