diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b57d2b6..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 @@ -33,7 +32,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..2e395c4 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 @@ -36,12 +37,50 @@ 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 + before_all do |lane| + build_lanes = %i[ + build_and_sign + run_test_suite + ] + + 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( @@ -72,11 +111,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 +198,17 @@ 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 + ) + end + + #DEVELOP lane :build_develop do build_and_sign( scheme: app_name+'-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' diff --git a/ios-baseUITests/ios_baseUITests.swift b/ios-baseUITests/ios_baseUITests.swift index 8c395de..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,8 @@ class ios_baseUITests: XCTestCase { app.launchArguments = ["Automation Test"] try? networkMocker.setUp() + networkMocker.stubLogOut() + app.logOutIfNeeded(in: self) } override func tearDown() { @@ -86,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() { @@ -106,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() {