From 711304bf37c739af2d42c6a94a21c74149cf76e9 Mon Sep 17 00:00:00 2001 From: German Lopez Date: Fri, 25 Feb 2022 15:12:11 -0300 Subject: [PATCH 1/4] Fix UI test suite --- ios-baseUITests/ios_baseUITests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/ios-baseUITests/ios_baseUITests.swift b/ios-baseUITests/ios_baseUITests.swift index 8c395de..9c22692 100644 --- a/ios-baseUITests/ios_baseUITests.swift +++ b/ios-baseUITests/ios_baseUITests.swift @@ -21,6 +21,7 @@ class ios_baseUITests: XCTestCase { app.launchArguments = ["Automation Test"] try? networkMocker.setUp() + app.logOutIfNeeded(in: self) } override func tearDown() { From 5706d25bfc4f257d096985a0ab541504fd4a7019 Mon Sep 17 00:00:00 2001 From: German Lopez Date: Fri, 25 Feb 2022 15:23:43 -0300 Subject: [PATCH 2/4] Update fastfile and GitHub actions YML --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 6 +++--- fastlane/Fastfile | 37 +++++++++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b57d2b6..5b4968c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: Run tests uses: maierj/fastlane-action@v1.4.0 with: - lane: debug_develop + lane: run_test_suite - name: Send test coverage report run: ./cc-test-reporter after-build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e58636c..99d36ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Develop Release on: push: branches: - - develop + - master env: LANG: en_US.UTF-8 @@ -30,11 +30,11 @@ env: APP_STORE_CONNECT_API_KEY_FILE: ${{ secrets.APP_STORE_CONNECT_API_KEY_FILE }} # Notifications SLACK_URL: ${{ secrets.SLACK_URL }} - SLACK_CHANNEL: '#dev-releases' + SLACK_CHANNEL: '#dev-builds' jobs: ios: - runs-on: macmini + runs-on: macos-latest timeout-minutes: 45 steps: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 39f3902..064c106 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -19,6 +19,7 @@ default_platform(:ios) # CONFIG VARIABLES app_name = 'ios-base' +workspace = app_name+'.xcworkspace' team_id = ENV["APPLE_TEAM_ID"] # The organization's team id in the Apple Developer portal cert = ENV["APPLE_CERT"] # Local path to distribution certificate file to be used for signing the build key = ENV["APPLE_KEY"] # Private key (.p12 file) used for encrypting certificate @@ -38,10 +39,20 @@ folder = ENV["FOLDER"] # slack_channel = ENV["SLACK_CHANNEL"] # Slack webhook url and channel name for sending notifications upon completion slack_url = ENV["SLACK_URL"] # - - platform :ios do + before_all do |lane| + build_lanes = %i[ + build_and_sign + run_test_suite + ] + + if build_lanes.include?(lane) + bundle_install + cocoapods(repo_update: true) + end + end + lane :set_signing do # Create keychain - (Travis setup works for GitHhub Actions too) setup_ci( @@ -72,11 +83,9 @@ platform :ios do lane :build_and_sign do |options| set_signing - # pod install - cocoapods gym( scheme: options[:scheme], - workspace: app_name+'.xcworkspace', + workspace: workspace, export_method: options[:method], export_options: {iCloudContainerEnvironment: 'Production'}, clean: true, @@ -161,7 +170,23 @@ platform :ios do ) end -#DEVELOP + # TESTING + lane :run_test_suite do + scan( + workspace: workspace, + scheme: app_name+"-develop", + devices: ["iPhone 13 Pro"], + code_coverage: true + ) + # scan( + # workspace: workspace, + # scheme: app_name+"-develop", + # devices: ["iPhone 13"], + # code_coverage: false + # ) + end + + #DEVELOP lane :build_develop do build_and_sign( scheme: app_name+'-develop', From 500b098732b657df4d259496c9a92646ee5434fe Mon Sep 17 00:00:00 2001 From: German Lopez Date: Fri, 25 Feb 2022 16:08:07 -0300 Subject: [PATCH 3/4] Fix UI tests logout setup --- ios-baseUITests/ios_baseUITests.swift | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ios-baseUITests/ios_baseUITests.swift b/ios-baseUITests/ios_baseUITests.swift index 9c22692..0d247cc 100644 --- a/ios-baseUITests/ios_baseUITests.swift +++ b/ios-baseUITests/ios_baseUITests.swift @@ -7,7 +7,6 @@ // import XCTest -@testable import ios_base_Debug class ios_baseUITests: XCTestCase { @@ -21,6 +20,7 @@ class ios_baseUITests: XCTestCase { app.launchArguments = ["Automation Test"] try? networkMocker.setUp() + networkMocker.stubLogOut() app.logOutIfNeeded(in: self) } @@ -87,13 +87,6 @@ class ios_baseUITests: XCTestCase { alert.buttons.allElementsBoundByIndex.first?.tap() } - - let logOutButton = app.buttons["LogoutButton"] - waitFor(element: logOutButton, timeOut: 5) - - networkMocker.stubLogOut() - - logOutButton.tap() } func testSignInSuccess() { @@ -107,12 +100,6 @@ class ios_baseUITests: XCTestCase { let logOutButton = app.buttons["LogoutButton"] waitFor(element: logOutButton, timeOut: 10) - - networkMocker.stubLogOut() - logOutButton.forceTap() - - let goToSignInButton = app.buttons["GoToSignInButton"] - waitFor(element: goToSignInButton, timeOut: 10) } func testSignInFailure() { From 76b8dc01233365253ccad3965a303819043cf87e Mon Sep 17 00:00:00 2001 From: German Lopez Date: Wed, 9 Mar 2022 16:22:07 -0300 Subject: [PATCH 4/4] Update fastlane to run tests --- .github/workflows/ci.yml | 1 - fastlane/Fastfile | 36 +++++++++++++++++++++++++++++------- fastlane/Pluginfile | 3 ++- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b4968c..3000f93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ name: CI Build # Run for any commits to any branch on: [push, pull_request] - env: LANG: en_US.UTF-8 # CodeClimate diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 064c106..2e395c4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -37,7 +37,11 @@ folder = ENV["FOLDER"] # # Slack slack_channel = ENV["SLACK_CHANNEL"] # Slack webhook url and channel name for sending notifications upon completion -slack_url = ENV["SLACK_URL"] # +slack_url = ENV["SLACK_URL"] + +# Google +google_services_file = "GoogleService-Info.plist" +google_services_file_path = "#{app_name}/Resources/#{google_services_file}" platform :ios do @@ -50,9 +54,33 @@ platform :ios do if build_lanes.include?(lane) bundle_install cocoapods(repo_update: true) + setup_google_services end end + # This lane will fetch the Google secrets file from S3. + # If your app uses Google services, like Firebase, this lane must be + # executed before building the application. + lane :setup_google_services do + s3_download( + access_key_id: s3_key, + secret_access_key: s3_secret_key, + bucket: s3_bucket, + file_name: google_services_file, + output_path: google_services_file_path + ) + end + + # Execute this lane if you want to update the Google secrets file on the S3 bucket + lane :update_remote_google_services do + s3_upload( + access_key_id: s3_key, + secret_access_key: s3_secret_key, + bucket: s3_bucket, + content_path: google_services_file_path + ) + end + lane :set_signing do # Create keychain - (Travis setup works for GitHhub Actions too) setup_ci( @@ -178,12 +206,6 @@ platform :ios do devices: ["iPhone 13 Pro"], code_coverage: true ) - # scan( - # workspace: workspace, - # scheme: app_name+"-develop", - # devices: ["iPhone 13"], - # code_coverage: false - # ) end #DEVELOP diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 79ba9e7..cfbd0df 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -2,4 +2,5 @@ # # Ensure this file is checked in to source control! -gem 'fastlane-plugin-aws_s3' \ No newline at end of file +gem 'fastlane-plugin-aws_s3' +gem 'fastlane-plugin-s3_actions'