File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1042,6 +1042,11 @@ lane :test_without_building do |options|
10421042 e . include? ( options [ :name ] )
10431043 end . first
10441044
1045+ # FIXME: I do realize the variable is called "test plan path" but we're
1046+ # actually dealing with an `xctestrun`. I'll rename them all once established
1047+ # this approach works
1048+ add_buildkite_analytics_token ( xctestrun_path : testPlanPath )
1049+
10451050 UI . user_error! ( 'Unable to find .xctestrun file' ) unless !testPlanPath . nil? && File . exist? ( ( testPlanPath ) )
10461051
10471052 run_tests (
@@ -1101,3 +1106,20 @@ def trigger_buildkite_release_build(branch:, beta:)
11011106 pipeline_file : 'release-builds.yml'
11021107 )
11031108end
1109+
1110+ def add_buildkite_analytics_token ( xctestrun_path :)
1111+ require 'plist'
1112+
1113+ token_key = 'BUILDKITE_ANALYTICS_TOKEN'
1114+ token = ENV [ token_key ]
1115+ return if token . nil?
1116+
1117+ xctestrun = Plist . parse_xml ( xctestrun_path )
1118+ xctestrun [ 'TestConfigurations' ] . each do |configuration |
1119+ configuration [ 'TestTargets' ] . each do |target |
1120+ target [ 'EnvironmentVariables' ] [ token_key ] = token
1121+ end
1122+ end
1123+
1124+ File . write ( xctestrun_path , Plist ::Emit . dump ( xctestrun ) )
1125+ end
You can’t perform that action at this time.
0 commit comments