diff --git a/.gitignore b/.gitignore
index f3776ec..3882e93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,7 @@ xcuserdata/
*.xcscmblueprint
xcuserdata
-/fastlane/*.xcresult
+/fastlane/xcresult
/fastlane/*.xml
/vendor
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..ec08ab7
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,35 @@
+inherit_mode:
+ merge:
+ - Include
+
+AllCops:
+ Exclude:
+ - 'Carthage/**/*'
+ - 'Demo/Carthage/**/*'
+ - 'vendor/**/*'
+ Include:
+ - 'fastlane/Pluginfile'
+
+# this would cause errors with long lanes
+Metrics/BlockLength:
+ Enabled: true
+ ExcludedMethods: ['platform', 'for_platform']
+
+# Lane description and gem lines can be long
+Layout/LineLength:
+ Enabled: true
+ Max: 100
+ IgnoredPatterns: ['^gem', '^(\s+|)desc', '^(\s+|)UI.']
+
+# They have not to be snake_case
+Naming/FileName:
+ Exclude:
+ - '**/Appfile'
+ - '**/Gemfile'
+ - '**/Pluginfile'
+ - '**/Fastfile'
+
+# Variables have to be as described in fastlane documentation
+Style/RedundantInterpolation:
+ Exclude:
+ - '**/Appfile'
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 048e2d9..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: swift
-osx_image: xcode11.2
-cache:
- bundler: true
- directories:
- - Carthage
-before_install:
- - brew update
- - brew outdated carthage || brew upgrade carthage
-script:
- - bundle exec fastlane ios tests
diff --git a/Demo/Demo.entitlements b/Demo/Demo.entitlements
new file mode 100644
index 0000000..c2bf81b
--- /dev/null
+++ b/Demo/Demo.entitlements
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.developer.associated-domains
+
+ webcredentials:*.rts.ch
+
+
+
diff --git a/Demo/Demo.xcconfig b/Demo/Demo.xcconfig
index 6bb620e..dabae3c 100644
--- a/Demo/Demo.xcconfig
+++ b/Demo/Demo.xcconfig
@@ -1,5 +1,5 @@
// Version information
-MARKETING_VERSION = 3.0.2
+MARKETING_VERSION = 3.0.3
// Deployment targets
IPHONEOS_DEPLOYMENT_TARGET = 9.0
diff --git a/Demo/SRGIdentity-demo.xcodeproj/project.pbxproj b/Demo/SRGIdentity-demo.xcodeproj/project.pbxproj
index 6fe420c..ad94b7e 100644
--- a/Demo/SRGIdentity-demo.xcodeproj/project.pbxproj
+++ b/Demo/SRGIdentity-demo.xcodeproj/project.pbxproj
@@ -30,6 +30,7 @@
084CD6FE21696C0A00905A38 /* SRGLogger.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SRGLogger.framework; path = Carthage/Build/iOS/SRGLogger.framework; sourceTree = ""; };
086FB2CA21368ADE00DE4CF2 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
086FB33521380D9300DE4CF2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 08FCE70A25B8F0430031C512 /* Demo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Demo.entitlements; sourceTree = ""; };
6F0402F4233131AE00DA4D97 /* Demo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Demo.xcconfig; sourceTree = ""; };
6F3C7A0424C62F5900199F64 /* SceneDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; };
6F3C7A0524C62F5900199F64 /* SceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; };
@@ -67,6 +68,7 @@
6F0EB52720FC7F58009C02CF = {
isa = PBXGroup;
children = (
+ 08FCE70A25B8F0430031C512 /* Demo.entitlements */,
6F0402F4233131AE00DA4D97 /* Demo.xcconfig */,
086FB33521380D9300DE4CF2 /* Info.plist */,
6F8A93F220FDCAA800AA6434 /* Sources */,
@@ -373,6 +375,7 @@
baseConfigurationReference = 6F0402F4233131AE00DA4D97 /* Demo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "$(APP_ICONS_SOURCE)";
+ CODE_SIGN_ENTITLEMENTS = Demo.entitlements;
DEVELOPMENT_TEAM = VMGRRW6SG7;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -389,6 +392,7 @@
baseConfigurationReference = 6F0402F4233131AE00DA4D97 /* Demo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "$(APP_ICONS_SOURCE)";
+ CODE_SIGN_ENTITLEMENTS = Demo.entitlements;
DEVELOPMENT_TEAM = VMGRRW6SG7;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
diff --git a/Gemfile b/Gemfile
index ea0afbf..5d378ba 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,6 +7,7 @@
source 'https://rubygems.org'
gem 'fastlane'
+gem 'xcode-install'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
diff --git a/Gemfile.lock b/Gemfile.lock
index 206ead3..c49ddfb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,86 +1,79 @@
-GIT
- remote: https://github.com/SRGSSR/trainer
- revision: b39b3a996a18d87b8f19ce3e31a607198ce34581
- tag: 0.9.1.1
- specs:
- fastlane-plugin-trainer (0.4.1)
- trainer (>= 0.7.0)
- trainer (0.9.1.1)
- fastlane (>= 2.25.0)
- plist (>= 3.1.0, < 4.0.0)
-
GEM
remote: https://rubygems.org/
specs:
- CFPropertyList (3.0.2)
+ CFPropertyList (3.0.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
+ artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.1.0)
- aws-partitions (1.298.0)
- aws-sdk-core (3.94.0)
+ aws-partitions (1.422.0)
+ aws-sdk-core (3.111.2)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
- aws-sdk-kms (1.30.0)
- aws-sdk-core (~> 3, >= 3.71.0)
+ aws-sdk-kms (1.41.0)
+ aws-sdk-core (~> 3, >= 3.109.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.61.2)
- aws-sdk-core (~> 3, >= 3.83.0)
+ aws-sdk-s3 (1.87.0)
+ aws-sdk-core (~> 3, >= 3.109.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
- aws-sigv4 (1.1.2)
- aws-eventstream (~> 1.0, >= 1.0.2)
- babosa (1.0.3)
+ aws-sigv4 (1.2.2)
+ aws-eventstream (~> 1, >= 1.0.2)
+ babosa (1.0.4)
claide (1.0.3)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
- declarative (0.0.10)
+ declarative (0.0.20)
declarative-option (0.1.0)
- digest-crc (0.5.1)
+ digest-crc (0.6.3)
+ rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
- dotenv (2.7.5)
- emoji_regex (1.0.1)
- excon (0.73.0)
- faraday (0.17.3)
+ dotenv (2.7.6)
+ emoji_regex (3.2.1)
+ excon (0.78.1)
+ faraday (1.3.0)
+ faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
- faraday-cookie_jar (0.0.6)
- faraday (>= 0.7.4)
+ ruby2_keywords
+ faraday-cookie_jar (0.0.7)
+ faraday (>= 0.8.0)
http-cookie (~> 1.0.0)
- faraday_middleware (0.13.1)
- faraday (>= 0.7.4, < 1.0)
- fastimage (2.1.7)
- fastlane (2.145.0)
+ faraday-net_http (1.0.1)
+ faraday_middleware (1.0.0)
+ faraday (~> 1.0)
+ fastimage (2.2.1)
+ fastlane (2.172.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
+ artifactory (~> 3.0)
aws-sdk-s3 (~> 1.0)
- babosa (>= 1.0.2, < 2.0.0)
+ babosa (>= 1.0.3, < 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, < 2.0)
+ emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
- faraday (~> 0.17)
+ faraday (~> 1.0)
faraday-cookie_jar (~> 0.0.6)
- faraday_middleware (~> 0.13.1)
+ faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
- google-api-client (>= 0.29.2, < 0.37.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)
+ jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
- multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
- public_suffix (~> 2.0.0)
- rubyzip (>= 1.3.0, < 2.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)
@@ -92,9 +85,10 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
- fastlane-plugin-xcconfig (2.0.0)
+ fastlane-plugin-trainer (0.4.1)
+ trainer (>= 0.7.0)
gh_inspector (1.1.3)
- google-api-client (0.36.4)
+ google-api-client (0.38.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9)
httpclient (>= 2.8.1, < 3.0)
@@ -102,20 +96,35 @@ GEM
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.12)
+ google-apis-core (0.2.1)
+ addressable (~> 2.5, >= 2.5.1)
+ googleauth (~> 0.14)
+ httpclient (>= 2.8.1, < 3.0)
+ mini_mime (~> 1.0)
+ representable (~> 3.0)
+ retriable (>= 2.0, < 4.0)
+ rexml
+ signet (~> 0.14)
+ webrick
+ google-apis-iamcredentials_v1 (0.1.0)
+ google-apis-core (~> 0.1)
+ google-apis-storage_v1 (0.1.0)
+ google-apis-core (~> 0.1)
google-cloud-core (1.5.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
- google-cloud-env (1.3.1)
+ google-cloud-env (1.4.0)
faraday (>= 0.17.3, < 2.0)
- google-cloud-errors (1.0.0)
- google-cloud-storage (1.26.0)
+ google-cloud-errors (1.0.1)
+ google-cloud-storage (1.30.0)
addressable (~> 2.5)
digest-crc (~> 0.4)
- google-api-client (~> 0.33)
+ google-apis-iamcredentials_v1 (~> 0.1)
+ google-apis-storage_v1 (~> 0.1)
google-cloud-core (~> 1.2)
googleauth (~> 0.9)
mini_mime (~> 1.0)
- googleauth (0.12.0)
+ googleauth (0.15.0)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
@@ -127,28 +136,30 @@ GEM
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.4.0)
- json (2.3.0)
- jwt (2.1.0)
+ json (2.5.1)
+ jwt (2.2.2)
memoist (0.16.2)
- mini_magick (4.10.1)
+ mini_magick (4.11.0)
mini_mime (1.0.2)
- multi_json (1.14.1)
- multi_xml (0.6.0)
+ multi_json (1.15.0)
multipart-post (2.0.0)
- nanaimo (0.2.6)
- naturally (2.2.0)
- os (1.1.0)
- plist (3.5.0)
- public_suffix (2.0.5)
+ nanaimo (0.3.0)
+ naturally (2.2.1)
+ os (1.1.1)
+ plist (3.6.0)
+ public_suffix (4.0.6)
+ rake (13.0.3)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
+ rexml (3.2.4)
rouge (2.0.7)
- rubyzip (1.3.0)
+ ruby2_keywords (0.0.4)
+ rubyzip (2.3.0)
security (0.1.3)
- signet (0.14.0)
+ signet (0.14.1)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
@@ -160,8 +171,11 @@ GEM
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
+ trainer (0.9.1)
+ fastlane (>= 2.25.0)
+ plist (>= 3.1.0, < 4.0.0)
tty-cursor (0.7.1)
- tty-screen (0.7.1)
+ tty-screen (0.8.1)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
uber (0.1.0)
@@ -169,16 +183,20 @@ GEM
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
+ webrick (1.7.0)
word_wrap (1.0.0)
- xcodeproj (1.16.0)
+ xcode-install (2.6.6)
+ claide (>= 0.9.1, < 1.1.0)
+ fastlane (>= 2.1.0, < 3.0.0)
+ xcodeproj (1.19.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
- nanaimo (~> 0.2.6)
+ nanaimo (~> 0.3.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
- xcpretty-travis-formatter (1.0.0)
+ xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS
@@ -186,8 +204,8 @@ PLATFORMS
DEPENDENCIES
fastlane
- fastlane-plugin-trainer!
- fastlane-plugin-xcconfig
+ fastlane-plugin-trainer
+ xcode-install
BUNDLED WITH
1.17.2
diff --git a/Package.swift b/Package.swift
index a394762..8ef1f5a 100644
--- a/Package.swift
+++ b/Package.swift
@@ -3,7 +3,7 @@
import PackageDescription
struct ProjectSettings {
- static let marketingVersion: String = "3.0.2"
+ static let marketingVersion: String = "3.0.3"
}
let package = Package(
diff --git a/Sources/SRGIdentity/SRGIdentityLoginViewController~tvos.m b/Sources/SRGIdentity/SRGIdentityLoginViewController~tvos.m
index 8be5358..c65362c 100644
--- a/Sources/SRGIdentity/SRGIdentityLoginViewController~tvos.m
+++ b/Sources/SRGIdentity/SRGIdentityLoginViewController~tvos.m
@@ -181,7 +181,8 @@ - (void)loadInstructionsStackViewInView:(UIView *)view
[NSLayoutConstraint activateConstraints:@[
[instructionsStackView.centerXAnchor constraintEqualToAnchor:view.centerXAnchor],
[instructionsStackView.bottomAnchor constraintEqualToAnchor:view.bottomAnchor constant:-38.f],
- [instructionsStackView.widthAnchor constraintEqualToConstant:1000.f]
+ [instructionsStackView.leadingAnchor constraintEqualToAnchor:view.leadingAnchor constant:40.f],
+ [instructionsStackView.trailingAnchor constraintEqualToAnchor:view.trailingAnchor constant:-40.f],
]];
UILabel *instructionsLabel = [[UILabel alloc] init];
diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md
index 48bfdf5..8601933 100644
--- a/docs/GETTING_STARTED.md
+++ b/docs/GETTING_STARTED.md
@@ -41,7 +41,9 @@ To allow for a user to login, call the `-loginWithEmailAddress:` instance method
```
- On iOS this presents a browser, in which the user can supply her credentials or open an account.
-- On tvOS a dedicated in-app view is presented, with which users can only log in (a message invite them to open an account on a computer or mobile device). You can customize the logo displayed on this view by adding an `identity_service_logo` image file to your project (with recommended size of 150x150 px).
+- On tvOS a dedicated in-app view is presented, with which users can only log in (a message invites them to open an account on a computer or mobile device).
+ - You can customize the logo displayed on this view by adding an `identity_service_logo` image file to your project (with recommended size of 150x150 px).
+ - To allow credentials autofill from a companion device, enable web credentials sharing by [adding the associated domains entitlement to your application and the associated domain file on your website.](https://developer.apple.com/documentation/safariservices/supporting_associated_domains)
A user remains logged in until she logs out.
diff --git a/docs/README.md b/docs/README.md
index bf94250..ae4faf5 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,6 +1,6 @@
[![SRG Identity logo](README-images/logo.png)](https://github.com/SRGSSR/srgidentity-apple)
-[![GitHub releases](https://img.shields.io/github/v/release/SRGSSR/srgidentity-apple)](https://github.com/SRGSSR/srgidentity-apple/releases) [![platform](https://img.shields.io/badge/platfom-ios%20%7C%20tvos-blue)](https://github.com/SRGSSR/srgidentity-apple) [![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager) [![Build Status](https://travis-ci.org/SRGSSR/srgidentity-apple.svg?branch=master)](https://travis-ci.org/SRGSSR/srgidentity-apple/branches) [![GitHub license](https://img.shields.io/github/license/SRGSSR/srgidentity-apple)](https://github.com/SRGSSR/srgidentity-apple/blob/master/LICENSE)
+[![GitHub releases](https://img.shields.io/github/v/release/SRGSSR/srgidentity-apple)](https://github.com/SRGSSR/srgidentity-apple/releases) [![platform](https://img.shields.io/badge/platfom-ios%20%7C%20tvos-blue)](https://github.com/SRGSSR/srgidentity-apple) [![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager) [![GitHub license](https://img.shields.io/github/license/SRGSSR/srgidentity-apple)](https://github.com/SRGSSR/srgidentity-apple/blob/master/LICENSE)
## About
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index e317ebc..da612eb 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -16,21 +16,31 @@ default_platform :ios
platform :ios do
before_all do
ensure_git_status_clean
- Dir.chdir('..') { sh 'make bootstrap' }
+
+ xcversion(version: '~> 12')
end
desc 'Run library tests'
lane :tests do
clean_result_files
- override_test_product_names
+ Device = Struct.new(:platform, :name)
+ TestBuild = Struct.new(:scheme, :scheme_suffix, :in_workspace)
+
+ iphone11 = Device.new('iOS', 'iPhone 11')
+ appletv = Device.new('tvOS', 'Apple TV')
+ devices = [iphone11, appletv]
+
+ scheme = swift_package_name
+ workspace_tests = TestBuild.new(scheme, '-tests', true)
+ test_builds = [workspace_tests]
- run_tests_with_devices(['iPhone 11', 'Apple TV'])
+ # Run all tests on various simulators
+ srg_run_tests(devices, test_builds)
- trainer(
- path: './fastlane',
- output_directory: './fastlane'
- )
+ # Produce JUnit files for CI
+ srg_trainer
+ override_junit_test_suite_names(test_builds)
end
after_all do
@@ -43,73 +53,83 @@ platform :ios do
end
end
-def clean_result_files
- Dir['*.xml'].each { |file| File.delete(file) }
- Dir['*.xcresult'].each { |folder| FileUtils.remove_entry(folder, true) }
+def swift_package_name
+ JSON.parse((sh 'swift package dump-package'))['name']
end
-# Override test product names to split iOS and tvOS test results
-def override_test_product_names
- set_xcconfig_value(
- path: 'Tests/Tests.xcconfig',
- name: 'PRODUCT_NAME[sdk=iphone*]',
- value: '$(PROJECT_NAME)-iOS'
- )
- set_xcconfig_value(
- path: 'Tests/Tests.xcconfig',
- name: 'PRODUCT_NAME[sdk=appletv*]',
- value: '$(PROJECT_NAME)-tvOS'
- )
+def clean_result_files
+ Dir['*.xml'].each { |file| File.delete(file) }
+ FileUtils.remove_entry('xcresult', true)
end
-def run_tests_with_devices(devices)
+def srg_run_tests(devices, test_builds)
devices.each do |device|
- srg_scan(device)
- copy_last_xcresult
+ test_builds.each do |test_build|
+ begin
+ srg_xcodebuild(device, test_build)
+ rescue StandardError => e
+ raise e unless e.message.include? '** TEST FAILED **'
+
+ UI.important('One or more tests failed on ' + device.platform + ' (' + srg_xcodebuild_scheme(test_build) + '). ⚠️')
+ end
+ end
end
- check_xcresult_count(devices)
end
-def srg_scan(device)
- scan(
- device: device,
- scheme: xcode_library_scheme,
- output_types: '',
- output_style: FastlaneCore::Env.truthy?('TRAVIS') ? 'raw' : 'standard',
- fail_build: false,
- clean: true
+def srg_xcodebuild(device, test_build)
+ xcodebuild(
+ test: true,
+ workspace: srg_xcodebuild_workspace(test_build),
+ scheme: srg_xcodebuild_scheme(test_build),
+ destination: srg_xcodebuild_destination(device),
+ result_bundle_path: srg_xcodebuild_result_bundle_path(device, test_build)
)
end
-def xcresults_path
- derived_data_path = lane_context[SharedValues::SCAN_DERIVED_DATA_PATH]
- derived_data_path + '/Logs/Test/'
+def srg_xcodebuild_workspace(test_build)
+ test_build.in_workspace ? 'Tests/' + srg_xcodebuild_scheme(test_build) + '.xcworkspace' : nil
end
-def copy_last_xcresult
- file = nil
- Dir.chdir(xcresults_path) do
- # max == sort.last
- file = Dir['*.xcresult'].max
- end
- file_name = File.basename(file)
- FileUtils.copy_entry(xcresults_path + file_name, file_name)
+def srg_xcodebuild_scheme(test_build)
+ test_build.scheme + test_build.scheme_suffix
end
-def check_xcresult_count(devices)
- return unless Dir['*.xcresult'].count != devices.count
+def srg_xcodebuild_destination(device)
+ 'platform=' + device.platform + ' Simulator,name=' + device.name
+end
- UI.user_error!('Whoops, unexpected xcresult file count.')
+def srg_xcodebuild_result_bundle_path(device, test_build)
+ result_bundle_folder_path + test_build.scheme + '-' + device.platform
+end
+
+# Convert xcresults to JUnit files
+def srg_trainer
+ trainer(
+ path: result_bundle_folder_path,
+ output_directory: './fastlane',
+ fail_build: false
+ )
end
-# Returns the library scheme
-def xcode_library_scheme
- scheme = nil
- Dir.chdir('..') do
- scheme = sh 'xcodebuild -list | grep "Schemes:" -A 1'
+def result_bundle_folder_path
+ './fastlane/xcresult/'
+end
+
+# Override JUnit test suite names to split iOS and tvOS test results
+def override_junit_test_suite_names(test_builds)
+ test_builds.each do |test_build|
+ Dir[test_build.scheme + '-*.xml'].each do |file_name|
+ override_junit_test_suite_name(file_name)
+ end
end
- scheme ['Schemes:'] = ''
- scheme.gsub(/\s+/, '').chomp
+end
+
+def override_junit_test_suite_name(file_name)
+ platform = file_name.split('.').first.split('-').last
+ file = File.open(file_name, 'r')
+ xml = file.read.gsub('Tests" tests="', '-' + platform + '" tests="')
+ xml = xml.gsub('-tests" tests="', '-' + platform + '" tests="')
+ File.open(file_name, 'w') { |f| f.write(xml) }
end
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile
index ac2f64b..72dfbbd 100644
--- a/fastlane/Pluginfile
+++ b/fastlane/Pluginfile
@@ -4,5 +4,4 @@
#
# Ensure this file is checked in to source control!
-gem 'fastlane-plugin-trainer', git: 'https://github.com/SRGSSR/trainer', tag: '0.9.1.1'
-gem 'fastlane-plugin-xcconfig'
+gem 'fastlane-plugin-trainer'
diff --git a/fastlane/README.md b/fastlane/README.md
index 26e446a..d2d323b 100644
--- a/fastlane/README.md
+++ b/fastlane/README.md
@@ -12,7 +12,7 @@ Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
-or alternatively using `brew cask install fastlane`
+or alternatively using `brew install fastlane`
# Available Actions
## iOS