diff --git a/.travis.yml b/.travis.yml index 825f82899..4c35801a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ osx_image: xcode10.1 language: swift +branches: + only: + - master + stages: - name: test - name: beta @@ -16,15 +20,19 @@ install: - cd subtrees/the-blue-alliance-react && npm install && cd ../.. - bundle install - bundle exec pod install --repo-update + +before_script: - cp mock-Secrets.plist the-blue-alliance-ios/Secrets.plist - bundle exec fastlane setup_ci + - echo -e "machine github.com\n login $GITHUB_TOKEN" > ~/.netrc + - bundle exec fastlane match_ci jobs: include: - stage: test name: "Unit Tests" - script: bundle exec fastlane test_unit - # - script: bundle exec fastlane test_ui + script: bundle exec fastlane scan --scheme tba-unit-tests + # - script: bundle exec fastlane scan --scheme tba-ui-tests # name: "UI Tests" - stage: beta script: bundle exec fastlane beta diff --git a/fastlane/Appfile b/fastlane/Appfile index 36b0fedcc..3eea2d1f0 100644 --- a/fastlane/Appfile +++ b/fastlane/Appfile @@ -1,2 +1,2 @@ -app_identifier "com.the-blue-alliance.tba" # The bundle identifier of your app +app_identifier "com.the-blue-alliance.tba" team_id "LKZ8X6P249" diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d377f4f81..696ba89b6 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -6,61 +6,31 @@ platform :ios do lane :setup_ci do setup_travis setup_secrets - setup_url_schemes - update_project_team end - ## CI Setup Lanes ## + ## CI Lanes ## desc "Setup Secrets.plist file (used by CI)" private_lane :setup_secrets do set_info_plist_value(path: "the-blue-alliance-ios/Secrets.plist", key: "tba_api_key", value: ENV['TBA_API_KEY']) end - desc "Setup URL schemes in our project" - private_lane :setup_url_schemes do - # Setup Google callback URL from GoogleService-Info.plist - identifier = get_info_plist_value(path: "the-blue-alliance-ios/GoogleService-Info.plist", key: "REVERSED_CLIENT_ID") - update_url_schemes(path: "the-blue-alliance-ios/Info.plist", url_schemes: [identifier]) - end - - ## End CI Setup Lanes ## - - ## Testing Lanes ## - - desc "Run unit tests" - lane :test_unit do - # Build for unit tests - run_tests( - scheme: "tba-unit-tests", - derived_data_path: "fastlane/derived_data/derived_data_unit", - build_for_testing: true - ) - # Run unit tests - run_tests( - scheme: "tba-unit-tests", - derived_data_path: "fastlane/derived_data/derived_data_unit", - test_without_building: true - ) - end - - desc "Run UI tests" - lane :test_ui do - # Build for UI tests - run_tests( - scheme: "tba-ui-tests", - derived_data_path: "fastlane/derived_data/derived_data_ui", - build_for_testing: true + desc "Run match on CI" + lane :match_ci do + match( + git_url: "https://#{ENV["GITHUB_TOKEN"]}@github.com/ZachOrr/tba-ios-certificates.git", + keychain_name: "fastlane_tmp_keychain" ) - # Run UI tests - run_tests( - scheme: "tba-ui-tests", - derived_data_path: "fastlane/derived_data/derived_data_ui", - test_without_building: true + update_project_team(teamid: ENV["sigh_com.the-blue-alliance.tba_appstore_team-id"]) + update_project_provisioning( + profile: ENV["sigh_com.the-blue-alliance.tba_appstore_profile-path"], + target_filter: "The Blue Alliance", + build_configuration: "Release", + code_signing_identity: "iPhone Distribution" ) end - ## End Testing Lanes ## + ## End CI Lanes ## ## Create A New Version Lanes ## @@ -68,24 +38,16 @@ platform :ios do lane :new_version do |options| version_type = options[:version_type] # Bump version accordingly - bump_version(version_type: version_type) - # Create new changelog file - version = "v#{get_version_number}" - if version_type == "build" - version = current_git_tag - end - sh("touch", "../changelogs/#{version}") - # Commit our version bump and changelog file - commit_version_bump(message: "[skip ci] New version - #{version}", xcodeproj: "the-blue-alliance-ios.xcodeproj", include: "changelogs/#{version}") - end - - desc "Bump the build version (major, minor, patch) and/or build number (build)" - private_lane :bump_version do |options| - version_type = options[:version_type] if version_type != "build" increment_version_number(bump_type: version_type) end increment_build_number + # Create new changelog file + if version_type != "build" + sh("touch", "../release_notes/#{current_version}") + end + # Commit our version bump and changelog file + commit_version_bump(message: "[skip ci] New version - #{current_version}", xcodeproj: "the-blue-alliance-ios.xcodeproj", include: "release_notes/#{current_version}") end ## End Create A New Version Lanes ## @@ -95,18 +57,26 @@ platform :ios do if !git_tag_exists(tag: current_git_tag) UI.success("`#{current_git_tag}` is a new version, all good! 💪") else - UI.user_error!("A tag with the name `#{current_git_tag}` already exists! Run `fastlane bump_version` to generate a new version.") + UI.user_error!("A tag with the name `#{current_git_tag}` already exists! Run `fastlane new_version` to generate a new version.") end end ## Release Lanes ## desc "Upload a new beta build to TestFlight" - lane :beta do - ship - pilot(changelog: build_changelog, distribute_external: true, wait_processing_interval: 300) # Upload to TestFlight - ship_github(is_prerelease: true) # Create GitHub release - slack(message: "#{current_git_tag} uploaded to TestFlight") + lane :beta do |options| + if is_ci? + slack(message: "Shipping #{current_git_tag} to TestFlight...") # Let us know + end + + preship + gym(scheme: "The Blue Alliance") + pilot(changelog: commit_changelog, distribute_external: true, wait_processing_interval: 300) # Upload to TestFlight + + if is_ci? + ship_github(is_prerelease: true) # Create GitHub release + slack(message: "#{current_git_tag} uploaded to TestFlight 🎉") + end end desc "Upload a new build to the App Store" @@ -114,7 +84,7 @@ platform :ios do # ship # deliver # ship_github(is_prerelease: false) # Create GitHub release - # slack(message: "#{current_git_tag} shipped to the App Store") + # slack(message: "#{current_git_tag} shipped to the App Store 🎉") end ## End Release Lanes ## @@ -122,15 +92,12 @@ platform :ios do ## Shipping Lanes for Release Lanes ## desc "Perform pre-ship tasks" - private_lane :ship do - ensure_git_status_clean # Ensure we're in a clean repo before uploading - ensure_git_branch # Ensure we're on master before shipping + private_lane :preship do + if is_ci == false + ensure_git_status_clean # Ensure we're in a clean repo before uploading + ensure_git_branch # Ensure we're on master before shipping + end ensure_version_bump # Ensure we're on a new version - - match(type: "appstore", readonly: true) # Sync our code signing with Match - # TODO: get_push_certificate, once we can manage uploading to Firebase preferrably - - gym(scheme: "The Blue Alliance") # Build our app end private_lane :ship_github do |options| @@ -140,7 +107,7 @@ platform :ios do name: current_git_tag, tag_name: current_git_tag, commitish: commit, - description: github_changelog, + description: commit_changelog, is_prerelease: options[:is_prerelease] ? true : false, upload_assets: ["The Blue Alliance.ipa", "The Blue Alliance.app.dSYM.zip"] ) @@ -151,32 +118,35 @@ platform :ios do ## Internal Lanes for Shipping Lanes ## private_lane :current_git_tag do - "v#{get_version_number}b#{get_build_number}" + "#{current_version}b#{get_build_number}" end - private_lane :changelog do |options| - version = options[:version] - File.read("../changelogs/#{version}") rescue "No changelog for #{version}" + private_lane :current_version do + "v#{get_version_number}" end - private_lane :version_changelog do - # Use our version changelog (no build number) - ex: `v1.0.0` - version = "v#{get_version_number}" - changelog(version: version) - end + # desc "Release notes and changelog" + # private_lane :github_changelog do + # "#{version_changelog}\n## Changelog\n#{commit_changelog}" + # end - private_lane :build_changelog do - # Use our build changelog - ex: `v1.0.0b6` - version = current_git_tag - changelog(version: version) - end + # desc "Release notes for version" + # private_lane :release_notes do + # File.read("../release_notes/#{current_version}") + # end - private_lane :github_changelog do - "## Release Notes\n#{version_changelog}\n## Changelog\n#{release_changelog}" - end + # desc "Get changelog from git commits between HEAD and last version tag" + # lane :commit_changelog_version do + # changelog_from_git_commits( + # pretty: changelog_commit_format, + # merge_commit_filtering: "exclude_merges" + # ) + # end - lane :release_changelog do + desc "Get changelog from git commits between HEAD and latest tag" + private_lane :commit_changelog do |options| changelog_from_git_commits( + # tag_match_pattern: options[:tag_match_pattern] || nil, pretty: "{{[%h|https://github.com/the-blue-alliance/the-blue-alliance-ios/commit/%h]}} [%an]: %s", merge_commit_filtering: "exclude_merges" ) diff --git a/fastlane/Gymfile b/fastlane/Gymfile new file mode 100644 index 000000000..e4435a937 --- /dev/null +++ b/fastlane/Gymfile @@ -0,0 +1 @@ +scheme("The Blue Alliance") diff --git a/fastlane/Matchfile b/fastlane/Matchfile index 96a5b42c3..5e6aa000d 100644 --- a/fastlane/Matchfile +++ b/fastlane/Matchfile @@ -1,4 +1,3 @@ git_url("git@github.com:ZachOrr/tba-ios-certificates.git") - type("appstore") readonly(true) diff --git a/fastlane/README.md b/fastlane/README.md index b3a437454..3db3445de 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -16,26 +16,16 @@ or alternatively using `brew cask install fastlane` # Available Actions ## iOS -### ios setup_secrets +### ios setup_ci ``` -fastlane ios setup_secrets +fastlane ios setup_ci ``` -Setup Secrets.plist file (used by CI) -### ios setup_url_schemes +Setup CI +### ios match_ci ``` -fastlane ios setup_url_schemes +fastlane ios match_ci ``` -Setup URL schemes in our project -### ios test_unit -``` -fastlane ios test_unit -``` -Run unit tests -### ios test_ui -``` -fastlane ios test_ui -``` -Run UI tests +Run match on CI ### ios new_version ``` fastlane ios new_version @@ -51,11 +41,6 @@ Upload a new beta build to TestFlight fastlane ios app_store ``` Upload a new build to the App Store -### ios release_changelog -``` -fastlane ios release_changelog -``` - ---- diff --git a/fastlane/Scanfile b/fastlane/Scanfile index 5f46673ea..9857a80ea 100644 --- a/fastlane/Scanfile +++ b/fastlane/Scanfile @@ -1,3 +1,4 @@ workspace("the-blue-alliance-ios.xcworkspace") devices(["iPhone X (11.4)", "iPhone X (12.1)"]) disable_concurrent_testing(true) +derived_data_path("fastlane/derived_data") diff --git a/changelogs/v1.0.0 b/release_notes/v1.0.0 similarity index 100% rename from changelogs/v1.0.0 rename to release_notes/v1.0.0 diff --git a/tba-ui-tests/Info.plist b/tba-ui-tests/Info.plist index c79f510fe..b585d91f2 100644 --- a/tba-ui-tests/Info.plist +++ b/tba-ui-tests/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString 1.0.0 CFBundleVersion - 8 + 9 diff --git a/tba-unit-tests/Info.plist b/tba-unit-tests/Info.plist index c79f510fe..b585d91f2 100644 --- a/tba-unit-tests/Info.plist +++ b/tba-unit-tests/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString 1.0.0 CFBundleVersion - 8 + 9 diff --git a/the-blue-alliance-ios.xcodeproj/project.pbxproj b/the-blue-alliance-ios.xcodeproj/project.pbxproj index 3dc692b1f..11349e090 100644 --- a/the-blue-alliance-ios.xcodeproj/project.pbxproj +++ b/the-blue-alliance-ios.xcodeproj/project.pbxproj @@ -1757,7 +1757,7 @@ 92942D911E2154DA008E79CA = { CreatedOnToolsVersion = 8.2.1; LastSwiftMigration = 1000; - ProvisioningStyle = Automatic; + ProvisioningStyle = Manual; SystemCapabilities = { com.apple.Push = { enabled = 1; @@ -2463,8 +2463,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "the-blue-alliance-ios/the-blue-alliance-ios.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 9; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "the-blue-alliance-ios/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -2484,8 +2484,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "the-blue-alliance-ios/the-blue-alliance-ios.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 9; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "the-blue-alliance-ios/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -2508,7 +2508,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CURRENT_PROJECT_VERSION = 9; DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "tba-ui-tests/Info.plist"; @@ -2533,7 +2533,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CURRENT_PROJECT_VERSION = 9; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "tba-ui-tests/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -2558,7 +2558,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CURRENT_PROJECT_VERSION = 9; DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "tba-unit-tests/Info.plist"; @@ -2584,7 +2584,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 8; + CURRENT_PROJECT_VERSION = 9; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "tba-unit-tests/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; diff --git a/the-blue-alliance-ios/Info.plist b/the-blue-alliance-ios/Info.plist index 1736d84c6..4b0ea41a0 100755 --- a/the-blue-alliance-ios/Info.plist +++ b/the-blue-alliance-ios/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 8 + 9 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS