diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..9ba8ee2e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,56 @@ +version: 2 +jobs: + build-and-test: + macos: + xcode: "11.5.0" + working_directory: /Users/aralduhin/swiftTest + environment: + FL_OUTPUT_DIR: output + FASTLANE_LANE: test + shell: /bin/bash --login -o pipefail + steps: + - checkout + - run: bundle install + - run: + name: Fastlane + command: bundle exec fastlane $FASTLANE_LANE + - store_artifacts: + path: output + - store_test_results: + path: output/scan + + + beta: + macos: + xcode: "11.5.0" + working_directory: /Users/aralduhin/swiftTest + environment: + FL_OUTPUT_DIR: output + FASTLANE_LANE: beta + shell: /bin/bash --login -o pipefail + steps: + - checkout + - run: bundle install + - run: + name: Fastlane + command: bundle exec fastlane $FASTLANE_LANE + - store_artifacts: + path: output/Game.ipa + +workflows: + version: 2 + build-test-adhoc: + jobs: + - build-and-test + - beta: + filters: + branches: + only: development + requires: + - build-and-test + #- beta: + #filters: + #branches: + #only: master + #requires: + #- build-and-test diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..7a118b49 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..49120304 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,180 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + atomos (0.1.3) + aws-eventstream (1.1.0) + aws-partitions (1.338.0) + aws-sdk-core (3.103.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-kms (1.36.0) + aws-sdk-core (~> 3, >= 3.99.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.73.0) + aws-sdk-core (~> 3, >= 3.102.1) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.2.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.3) + claide (1.0.3) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.20) + declarative-option (0.1.0) + digest-crc (0.6.1) + rake (~> 13.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.5) + emoji_regex (3.0.0) + excon (0.75.0) + faraday (1.0.1) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (1.0.0) + faraday (~> 1.0) + fastimage (2.1.7) + fastlane (2.150.3) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.2, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (>= 0.17, < 2.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (>= 0.13.1, < 2.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.37.0, < 0.39.0) + google-cloud-storage (>= 1.15.0, < 2.0.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + jwt (~> 2.1.0) + mini_magick (>= 4.9.4, < 5.0.0) + multi_xml (~> 0.5) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-api-client (0.38.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.12) + google-cloud-core (1.5.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.3.2) + faraday (>= 0.17.3, < 2.0) + google-cloud-errors (1.0.1) + google-cloud-storage (1.26.2) + addressable (~> 2.5) + digest-crc (~> 0.4) + google-api-client (~> 0.33) + google-cloud-core (~> 1.2) + googleauth (~> 0.9) + mini_mime (~> 1.0) + googleauth (0.13.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) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.4.0) + json (2.3.1) + jwt (2.1.0) + memoist (0.16.2) + mini_magick (4.10.1) + mini_mime (1.0.2) + multi_json (1.14.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nanaimo (0.2.6) + naturally (2.2.0) + os (1.1.0) + plist (3.5.0) + public_suffix (4.0.5) + rake (13.0.1) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rouge (2.0.7) + rubyzip (2.3.0) + security (0.1.3) + signet (0.14.0) + addressable (~> 2.3) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + slack-notifier (2.3.2) + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.7.1) + tty-screen (0.8.0) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) + unicode-display_width (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.17.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 1.17.2 diff --git a/HelloToTheUniverse.xcodeproj/project.pbxproj b/HelloToTheUniverse.xcodeproj/project.pbxproj index 3ec2e16e..f0c21b43 100644 --- a/HelloToTheUniverse.xcodeproj/project.pbxproj +++ b/HelloToTheUniverse.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 33D9182724B50AFC00BBB110 /* HelloToTheUniverseUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D9182624B50AFC00BBB110 /* HelloToTheUniverseUITests.swift */; }; + 33D9182F24B50B3500BBB110 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D9182E24B50B3500BBB110 /* SnapshotHelper.swift */; }; 5B59BC781D6E243800DFE0AD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B59BC771D6E243800DFE0AD /* AppDelegate.swift */; }; 5B59BC7A1D6E243800DFE0AD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B59BC791D6E243800DFE0AD /* ViewController.swift */; }; 5B59BC7D1D6E243800DFE0AD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B59BC7B1D6E243800DFE0AD /* Main.storyboard */; }; @@ -17,6 +19,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 33D9182924B50AFC00BBB110 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5B59BC6C1D6E243700DFE0AD /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5B59BC731D6E243800DFE0AD; + remoteInfo = HelloToTheUniverse; + }; 5B59BC891D6E243800DFE0AD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5B59BC6C1D6E243700DFE0AD /* Project object */; @@ -27,6 +36,10 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 33D9182424B50AFC00BBB110 /* HelloToTheUniverseUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HelloToTheUniverseUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 33D9182624B50AFC00BBB110 /* HelloToTheUniverseUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelloToTheUniverseUITests.swift; sourceTree = ""; }; + 33D9182824B50AFC00BBB110 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 33D9182E24B50B3500BBB110 /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = fastlane/SnapshotHelper.swift; sourceTree = SOURCE_ROOT; }; 5B59BC741D6E243800DFE0AD /* HelloToTheUniverse.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloToTheUniverse.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5B59BC771D6E243800DFE0AD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 5B59BC791D6E243800DFE0AD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -41,6 +54,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 33D9182124B50AFC00BBB110 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5B59BC711D6E243800DFE0AD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -65,11 +85,22 @@ name = Frameworks; sourceTree = ""; }; + 33D9182524B50AFC00BBB110 /* HelloToTheUniverseUITests */ = { + isa = PBXGroup; + children = ( + 33D9182E24B50B3500BBB110 /* SnapshotHelper.swift */, + 33D9182624B50AFC00BBB110 /* HelloToTheUniverseUITests.swift */, + 33D9182824B50AFC00BBB110 /* Info.plist */, + ); + path = HelloToTheUniverseUITests; + sourceTree = ""; + }; 5B59BC6B1D6E243700DFE0AD = { isa = PBXGroup; children = ( 5B59BC761D6E243800DFE0AD /* HelloToTheUniverse */, 5B59BC8B1D6E243800DFE0AD /* HelloToTheUniverseTests */, + 33D9182524B50AFC00BBB110 /* HelloToTheUniverseUITests */, 5B59BC751D6E243800DFE0AD /* Products */, 03815CCC50B8449A4AE99CE5 /* Frameworks */, ); @@ -80,6 +111,7 @@ children = ( 5B59BC741D6E243800DFE0AD /* HelloToTheUniverse.app */, 5B59BC881D6E243800DFE0AD /* HelloToTheUniverseTests.xctest */, + 33D9182424B50AFC00BBB110 /* HelloToTheUniverseUITests.xctest */, ); name = Products; sourceTree = ""; @@ -118,6 +150,24 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 33D9182324B50AFC00BBB110 /* HelloToTheUniverseUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33D9182B24B50AFC00BBB110 /* Build configuration list for PBXNativeTarget "HelloToTheUniverseUITests" */; + buildPhases = ( + 33D9182024B50AFC00BBB110 /* Sources */, + 33D9182124B50AFC00BBB110 /* Frameworks */, + 33D9182224B50AFC00BBB110 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 33D9182A24B50AFC00BBB110 /* PBXTargetDependency */, + ); + name = HelloToTheUniverseUITests; + productName = HelloToTheUniverseUITests; + productReference = 33D9182424B50AFC00BBB110 /* HelloToTheUniverseUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 5B59BC731D6E243800DFE0AD /* HelloToTheUniverse */ = { isa = PBXNativeTarget; buildConfigurationList = 5B59BC911D6E243800DFE0AD /* Build configuration list for PBXNativeTarget "HelloToTheUniverse" */; @@ -159,12 +209,19 @@ 5B59BC6C1D6E243700DFE0AD /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0730; + LastSwiftUpdateCheck = 1150; LastUpgradeCheck = 0730; ORGANIZATIONNAME = "Flatiron School"; TargetAttributes = { + 33D9182324B50AFC00BBB110 = { + CreatedOnToolsVersion = 11.5; + DevelopmentTeam = 2828KVL2FZ; + ProvisioningStyle = Automatic; + TestTargetID = 5B59BC731D6E243800DFE0AD; + }; 5B59BC731D6E243800DFE0AD = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = 2828KVL2FZ; LastSwiftMigration = 0800; }; 5B59BC871D6E243800DFE0AD = { @@ -179,6 +236,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -189,11 +247,19 @@ targets = ( 5B59BC731D6E243800DFE0AD /* HelloToTheUniverse */, 5B59BC871D6E243800DFE0AD /* HelloToTheUniverseTests */, + 33D9182324B50AFC00BBB110 /* HelloToTheUniverseUITests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 33D9182224B50AFC00BBB110 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5B59BC721D6E243800DFE0AD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -214,6 +280,15 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 33D9182024B50AFC00BBB110 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33D9182724B50AFC00BBB110 /* HelloToTheUniverseUITests.swift in Sources */, + 33D9182F24B50B3500BBB110 /* SnapshotHelper.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5B59BC701D6E243800DFE0AD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -235,6 +310,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 33D9182A24B50AFC00BBB110 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5B59BC731D6E243800DFE0AD /* HelloToTheUniverse */; + targetProxy = 33D9182924B50AFC00BBB110 /* PBXContainerItemProxy */; + }; 5B59BC8A1D6E243800DFE0AD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 5B59BC731D6E243800DFE0AD /* HelloToTheUniverse */; @@ -262,6 +342,75 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 33D9182C24B50AFC00BBB110 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 2828KVL2FZ; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = HelloToTheUniverseUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.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 = com.test.uitest.HelloToTheUniverseUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = HelloToTheUniverse; + }; + name = Debug; + }; + 33D9182D24B50AFC00BBB110 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 2828KVL2FZ; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = HelloToTheUniverseUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.5; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.test.uitest.HelloToTheUniverseUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = HelloToTheUniverse; + }; + name = Release; + }; 5B59BC8F1D6E243800DFE0AD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -349,11 +498,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 2828KVL2FZ; INFOPLIST_FILE = HelloToTheUniverse/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.flatironSchool.HelloToTheUniverse; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -361,11 +511,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 2828KVL2FZ; INFOPLIST_FILE = HelloToTheUniverse/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.flatironSchool.HelloToTheUniverse; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -398,6 +549,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 33D9182B24B50AFC00BBB110 /* Build configuration list for PBXNativeTarget "HelloToTheUniverseUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33D9182C24B50AFC00BBB110 /* Debug */, + 33D9182D24B50AFC00BBB110 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 5B59BC6F1D6E243800DFE0AD /* Build configuration list for PBXProject "HelloToTheUniverse" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/HelloToTheUniverse.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/HelloToTheUniverse.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/HelloToTheUniverse.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverse.xcscheme b/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverse.xcscheme index cc433b3f..d08714d3 100644 --- a/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverse.xcscheme +++ b/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverse.xcscheme @@ -45,6 +45,15 @@ + + + + @@ -56,18 +65,17 @@ ReferencedContainer = "container:HelloToTheUniverse.xcodeproj"> + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverseUITests.xcscheme b/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverseUITests.xcscheme new file mode 100644 index 00000000..43ccd697 --- /dev/null +++ b/HelloToTheUniverse.xcodeproj/xcshareddata/xcschemes/HelloToTheUniverseUITests.xcscheme @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/HelloToTheUniverse/AppDelegate.swift b/HelloToTheUniverse/AppDelegate.swift index 1558a91d..83331420 100644 --- a/HelloToTheUniverse/AppDelegate.swift +++ b/HelloToTheUniverse/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/HelloToTheUniverse/Greeting.swift b/HelloToTheUniverse/Greeting.swift index 26688e67..3da72c0a 100644 --- a/HelloToTheUniverse/Greeting.swift +++ b/HelloToTheUniverse/Greeting.swift @@ -14,7 +14,8 @@ class Greeting { // We created the function for you! Press command + u to run the tests. - func helloUniverse() -> String { + func helloUniverse() -> String { + print("test") return "Hello Universe!" } diff --git a/HelloToTheUniverseUITests/HelloToTheUniverseUITests.swift b/HelloToTheUniverseUITests/HelloToTheUniverseUITests.swift new file mode 100644 index 00000000..9c8411e0 --- /dev/null +++ b/HelloToTheUniverseUITests/HelloToTheUniverseUITests.swift @@ -0,0 +1,44 @@ +// +// HelloToTheUniverseUITests.swift +// HelloToTheUniverseUITests +// +// Created by Aleksandr Ralduhin on 07.07.2020. +// Copyright © 2020 Flatiron School. All rights reserved. +// + +import XCTest + +class HelloToTheUniverseUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { + XCUIApplication().launch() + } + } + } +} diff --git a/HelloToTheUniverseUITests/Info.plist b/HelloToTheUniverseUITests/Info.plist new file mode 100644 index 00000000..64d65ca4 --- /dev/null +++ b/HelloToTheUniverseUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + 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/Appfile b/fastlane/Appfile new file mode 100644 index 00000000..12909807 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,9 @@ +app_identifier("com.flatironSchool.HelloToTheUniverse") +apple_id "alexander.ralduhin@rallyware.com" # Your Apple email address + +team_id "2828KVL2FZ" # Developer Portal Team ID # The bundle identifier of your app +# apple_id("[[APPLE_ID]]") # Your Apple email address + + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 00000000..378eb4a9 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,34 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + before_all do + setup_circle_ci + end + + desc "Runs all the tests" + lane :test do + scan + snapshot + end + desc "Submit a new Beta Build to Apple TestFlight" + desc "This will also make sure the profile is up to date" + lane :beta do + match(type: "appstore") + gym(export_method: "app-store") + end +end diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 00000000..b4c0d191 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,36 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew cask install fastlane` + +# Available Actions +## iOS +### ios test +``` +fastlane ios test +``` +Runs all the tests +### ios beta +``` +fastlane ios beta +``` +Submit a new Beta Build to Apple TestFlight + +This will also make sure the profile is up to date + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/Snapfile b/fastlane/Snapfile new file mode 100644 index 00000000..a380f782 --- /dev/null +++ b/fastlane/Snapfile @@ -0,0 +1,37 @@ +# Uncomment the lines below you want to change by removing the # in the beginning + +# A list of devices you want to take the screenshots from +# devices([ +# "iPhone 8", +# "iPhone 8 Plus", +# "iPhone SE", +# "iPhone X", +# "iPad Pro (12.9-inch)", +# "iPad Pro (9.7-inch)", +# "Apple TV 1080p" +# ]) + +# languages([ +# "en-US", +# "de-DE", +# "it-IT", +# ["pt", "pt_BR"] # Portuguese with Brazilian locale +# ]) + +# The name of the scheme which contains the UI Tests +# scheme("SchemeName") + +# Where should the resulting screenshots be stored? +# output_directory("./screenshots") + +# remove the '#' to clear all previously generated screenshots before creating new ones +# clear_previous_screenshots(true) + +# Remove the '#' to set the status bar to 9:41 AM, and show full battery and reception. +# override_status_bar(true) + +# Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments +# launch_arguments(["-favColor red"]) + +# For more information about all available options run +# fastlane action snapshot diff --git a/fastlane/SnapshotHelper.swift b/fastlane/SnapshotHelper.swift new file mode 100644 index 00000000..f5b393c2 --- /dev/null +++ b/fastlane/SnapshotHelper.swift @@ -0,0 +1,282 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +var deviceLanguage = "" +var locale = "" + +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + locale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if locale.isEmpty && !deviceLanguage.isEmpty { + locale = Locale(identifier: deviceLanguage).identifier + } + + if !locale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(locale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + try screenshot.pngRepresentation.write(to: path) + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.23]