Xcode Bots将结果放在哪里,以便我可以解析它们? [英] Where do Xcode Bots put their results, so I can parse them?

查看:107
本文介绍了Xcode Bots将结果放在哪里,以便我可以解析它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的开发团队一直将Jenkins用于我们的iOS版本,并使用Philips Hue灯通知该团队何时构建为黄色",成功"(绿色),失败"(红色).

Our dev team has always used Jenkins for our iOS builds, and used Philips Hue lights to inform the team when the build is Building(Yellow), Successful(Green), Failed(Red).

现在,我们已移至

Now we have moved to Xcode CI and Bots, and I do not know when any unit tests fail. We don't even know if the build phase failed.

在Xcode Bots CI上,您可以获得以下大屏幕"功能: 在Apple的从一个管理和监视机器人的机器人中Web浏览器"文档,您会看到它具有各种状态,可能会触发色调灯.

On Xcode Bots CI you get this "bigscreen" feature: In Apple's "Manage and Monitor Bots from a Web Browser" Docs, you can see that it has all sorts of states that could key up a hue light.

我真的不想破解某些东西并解析HTML页面.尽管很有趣,但是如果Apple更新其HTML标记,这项工作不会持续很长时间.

I really don't want to hack something up and parse an HTML page. Although fun, the work does not last long if Apple updates their HTML markup.

当Xcode机器人完成其集成时,会生成一个可解析的文件吗?

Is there a parseable file that is produced when a Xcode bot finishes its integration?

我很想让Hue显示出来:
*蓝色为分析警告
*橙色用于生成警告
*红色表示构建错误
*黄色,表示正在运行

I'd love to get the Hue showing:
* Blue for Analysis warnings
* Orange for Build Warnings
* Red for Build Errors
* Yellow for build running

推荐答案

我想分享团队的解决方案.我们找到了Bot Results的存储位置,我们使用bash对其进行了解析,然后通过curl系统调用将消息发送到HUE light.我们在方案之前和之后都将脚本称为Build脚本.

I'd like to share the team's solution. We found the place where the Bot Results are stored, we parse it using bash, and send messages to the HUE light via curl system calls. We call the script in a scheme pre and post Build scripts.

我们在以下位置解析机器人的结果列表:

We parse the bot's result plist at:

/库/服务器/Xcode/数据/BotRuns/最新/输出/xcodebuild_result.bundle/Info.plist

/Library/Server/Xcode/Data/BotRuns/Latest/output/xcodebuild_result.bundle/Info.plist

您可以在其中找到各种很酷的数据供使用!:

There you can find all sorts of cool data to use!:

<dict>
    <key>AnalyzerWarningCount</key>
    <integer>0</integer>
    <key>AnalyzerWarningSummaries</key>
    <array/>
    <key>ErrorCount</key>
    <integer>0</integer>
    <key>ErrorSummaries</key>
    <array/>
    <key>LogIdentifier</key>
    <string>705bffcb-7453-49ba-882f-80e1218b59cf</string>
    <key>LogPath</key>
    <string>1_Test/action.xcactivitylog</string>
    <key>Status</key>
    <string>IDEActionResultStatus_Succeeded</string>
    <key>TestFailureSummaries</key>
    <array/>
    <key>TestSummaryIdentifier</key>
    <string>a1554874-4d40-4e94-ae89-a73184ec97a9</string>
    <key>TestSummaryPath</key>
    <string>1_Test/action_TestSummaries.plist</string>
    <key>TestsCount</key>
    <integer>185</integer>
    <key>TestsFailedCount</key>
    <integer>0</integer>
    <key>WarningCount</key>
    <integer>0</integer>
    <key>WarningSummaries</key>
    <array/>
<dict>

  • AnalyzerWarningCount
  • ErrorCount
  • 警告计数
  • TestsFailedCount
    • AnalyzerWarningCount
    • ErrorCount
    • WarningCount
    • TestsFailedCount
    • 哦,我的爱人bash,再次度过美好的一天.

      Oh bash, my sometimes lover, come save the day again.

      还请注意,使用Plist Buddy来解析Xcode的XML属性列表文件.从plist文件中获取信息的主要选择.

      Also notice the use of the Plist Buddy for parsing Xcode's XML property list files. The primo choice for getting information in and out of plist files.

          #!/bin/bash
          #
          #   By Phil
          #
          exec > /tmp/my_log_file.txt 2>&1
          TEST_RESULT_PLIST="/Library/Server/Xcode/Data/BotRuns/Latest/output/xcodebuild_result.bundle/Info.plist"
      
          hue_light_green=false
      
          echo "testResultParse_OwlHue"
      
          #If not bot, return
          if [ "$(whoami)" != "_teamsserver" ]; then
              echo "$(whoami) - Not a bot!";
              exit 1
          fi
      
          #1 If file not found ERROR
          if [ ! -f $TEST_RESULT_PLIST ]; then
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"effect\":\"none\",\"hue\":150,\"sat\":255,\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
              echo "Test Result Plist not Found";
              exit 1
          fi
      
          #2 AnalyzerWarningCount BLUE
          AnalyzerWarningCount=$(/usr/libexec/PlistBuddy -c "Print :AnalyzerWarningCount" "${TEST_RESULT_PLIST}")
          if [ $AnalyzerWarningCount != 0 ]; then
              echo "AnalyzerWarningCount";
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"xy\":[0.16, 0.1],\"hue\":15815,\"sat\":255,\"effect\":\"none\",\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
          fi
      
          #3 WarningCount
          WarningCount=$(/usr/libexec/PlistBuddy -c "Print :WarningCount" "${TEST_RESULT_PLIST}")
          if [ $WarningCount != 0 ]; then
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"xy\":[0.58, 0.41],\"hue\":15815,\"sat\":255,\"effect\":\"none\",\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
              echo "WarningCount";
          fi
      
          #4 ErrorCount || TestsFailedCount ERROR
          ErrorCount=$(/usr/libexec/PlistBuddy -c "Print :ErrorCount" "${TEST_RESULT_PLIST}")
          if [ $ErrorCount != 0 ]; then
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"effect\":\"none\",\"hue\":150,\"sat\":255,\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
              echo "ErrorCount";
              exit 1
          fi
      
          #5 TestsFailedCount ERROR
          ErrorCount=$(/usr/libexec/PlistBuddy -c "Print :ErrorCount" "${TEST_RESULT_PLIST}")
          if [ $TestsFailedCount != 0 ]; then
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"effect\":\"none\",\"hue\":150,\"sat\":255,\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
              echo "TestsFailedCount";
              exit 1
          fi
      
          #6 None of the above.  SUCCESS
          if [ "$hue_light_green" = true ] ; then
              echo "SUCCESS";
              curl -X PUT -d "{\"on\":true,\"bri\":32,\"effect\":\"none\",\"hue\":25500,\"sat\":255,\"alert\":\"lselect\"}" ipaddress/api/testestest/lights/3/state
          fi
      

      • AnalyzerWarningCount 蓝色
      • ErrorCount 红色
      • 警告计数橙色
      • TestsFailedCount 红色
        • AnalyzerWarningCount Blue
        • ErrorCount Red
        • WarningCount Orange
        • TestsFailedCount Red
        • 现在,当我们获得以上任何一项的计数时,我们都会看到闪烁的颜色变化.例如,以下内容会从我们的色调中产生亮蓝色:

          Now when we get a count for any of the above, we get a blinking color change. For example, the following produces a bright blue from our hue:

          这篇关于Xcode Bots将结果放在哪里,以便我可以解析它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆