File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ Metrics/BlockLength:
22 Exclude :
33 - fastlane/Fastfile
44
5+ Metrics/MethodLength :
6+ Max : 20
7+
58Style/AsciiComments :
69 Exclude :
710 - fastlane/Fastfile
Original file line number Diff line number Diff line change @@ -1105,3 +1105,37 @@ def trigger_buildkite_release_build(branch:, beta:)
11051105 pipeline_file : 'release-builds.yml'
11061106 )
11071107end
1108+
1109+ def inject_buildkite_analytics_environment ( xctestrun_path :)
1110+ require 'plist'
1111+
1112+ xctestrun = Plist . parse_xml ( xctestrun_path )
1113+ xctestrun [ 'TestConfigurations' ] . each do |configuration |
1114+ configuration [ 'TestTargets' ] . each do |target |
1115+ TEST_ANALYTICS_ENVIRONMENT . each do |key |
1116+ value = ENV . fetch ( key )
1117+ next if value . nil?
1118+
1119+ target [ 'EnvironmentVariables' ] [ key ] = value
1120+ end
1121+ end
1122+ end
1123+
1124+ File . write ( xctestrun_path , Plist ::Emit . dump ( xctestrun ) )
1125+ end
1126+
1127+ def buildkite_ci?
1128+ ENV . fetch ( 'BUILDKITE' , false )
1129+ end
1130+
1131+ # https://buildkite.com/docs/test-analytics/ci-environments
1132+ TEST_ANALYTICS_ENVIRONMENT = %w[
1133+ BUILDKITE_ANALYTICS_TOKEN
1134+ BUILDKITE_BUILD_ID
1135+ BUILDKITE_BUILD_NUMBER
1136+ BUILDKITE_JOB_ID
1137+ BUILDKITE_BRANCH
1138+ BUILDKITE_COMMIT
1139+ BUILDKITE_MESSAGE
1140+ BUILDKITE_BUILD_URL
1141+ ] . freeze
You can’t perform that action at this time.
0 commit comments