51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2809|回复: 2
打印 上一主题 下一主题

[转贴] 集成 fastlane 推送 ipa 到 testfight

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2017-6-15 13:12:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
上次写了将jenkins 集成 fastlane 打包 iOS 并将打包结果推送 slack,本次添加将打包生成的ipa推送testflight,主要会借助pilot命令。

Testflight当前已经被苹果公司收购并完善了功能,可以分发内测,作为提升app质量有很好的推动作用。
在安装好fastlane以后,其中的pilot命令可以查看一下它的参数:
  1. pilot

  2.   The best way to manage your TestFlight testers and builds from your terminal

  3.   Commands:
  4.     add        Adds new external tester(s) to a specific app (if given). This will also add an existing tester to an app.
  5.     builds     Lists all builds for given application
  6.     distribute Distribute a previously uploaded binary to Apple TestFlight
  7.     export     Exports all external testers to a CSV file
  8.     find       Find tester(s) (internal or external) by their email address
  9.     help       Display global or [command] help documentation
  10.     import     Create external testers from a CSV file
  11.     list       Lists all registered testers, both internal and external
  12.     remove     Remove external tester(s) by their email address
  13.     upload     Uploads a new binary to Apple TestFlight

  14.   Global Options:
  15.     -u, --username STRING Your Apple ID Username (PILOT_USERNAME)
  16.     -a, --app_identifier STRING The bundle identifier of the app to upload or manage testers (optional) (PILOT_APP_IDENTIFIER)
  17.     -i, --ipa STRING     Path to the ipa file to upload (PILOT_IPA)
  18.     -w, --changelog STRING Provide the what's new text when uploading a new build (PILOT_CHANGELOG)
  19.     -d, --beta_app_description STRING Provide the beta app description when uploading a new build (PILOT_BETA_APP_DESCRIPTION)
  20.     -n, --beta_app_feedback_email STRING Provide the beta app email when uploading a new build (PILOT_BETA_APP_FEEDBACK)
  21.     -s, --skip_submission [VALUE] Skip the distributing action of pilot and only upload the ipa file (PILOT_SKIP_SUBMISSION)
  22.     -z, --skip_waiting_for_build_processing [VALUE] Don't wait for the build to process. If set to true, the changelog won't be set
  23. (PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING)
  24.     -x, --update_build_info_on_upload [VALUE] Update build info immediately after validation. This will set the changelog even if PILOT_SKIP_SUBMISSION is set, but
  25. will have no effect if PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING is set (PILOT_UPDATE_BUILD_INFO_ON_UPLOAD)
  26.     -p, --apple_id STRING The unique App ID provided by iTunes Connect (PILOT_APPLE_ID)
  27.     --distribute_external [VALUE] Should the build be distributed to external testers? (PILOT_DISTRIBUTE_EXTERNAL)
  28.     -f, --first_name STRING The tester's first name (PILOT_TESTER_FIRST_NAME)
  29.     -l, --last_name STRING The tester's last name (PILOT_TESTER_LAST_NAME)
  30.     -e, --email STRING   The tester's email (PILOT_TESTER_EMAIL)
  31.     -c, --testers_file_path STRING Path to a CSV file of testers (PILOT_TESTERS_FILE)
复制代码
可以看到pilot是最好的方式管理你的TestFlight 测试人员和从终端构建的工具,注意:上传TestFlight的ipa必须打包方式是appstore,且版本号应该为3位并高于已经在线上Appstore可以下载的版本
我的上传脚本为:
  1. <span class="c">#!/bin/bash</span>
  2. <span class="nb">set</span> -x
  3. <span class="c">#计时</span>
  4. <span class="nv">SECONDS</span><span class="o">=</span>0

  5. <span class="c">#假设脚本放置在与项目相同的路径下</span>
  6. <span class="nv">project_path</span><span class="o">=</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span>
  7. <span class="c">#取当前时间字符串添加到文件结尾</span>
  8. <span class="nv">now</span><span class="o">=</span><span class="k">$(</span>date +<span class="s2">"%Y_%m_%d_%H_%M"</span><span class="k">)</span>
  9. <span class="c">#取替换BundleVersion的时间字符串</span>
  10. <span class="nv">now_date</span><span class="o">=</span><span class="k">$(</span>date +<span class="s2">"%Y%m%d%H%M"</span><span class="k">)</span>
  11. <span class="c">#获取当前脚本路径</span>
  12. <span class="nv">file_path</span><span class="o">=</span><span class="k">$(</span><span class="nb">cd</span> <span class="sb">`</span>dirname <span class="nv">$0</span><span class="sb">`</span>; <span class="nb">pwd</span><span class="k">)</span>

  13. <span class="c">#上传用户的username</span>
  14. <span class="nv">username</span><span class="o">=</span><span class="s2">"xx"</span>
  15. <span class="c">#上传用户App id</span>
  16. <span class="nv">apple_id</span><span class="o">=</span><span class="s2">"xx"</span>
  17. <span class="c">#bundleIdentifier</span>
  18. <span class="nv">bundle_id</span><span class="o">=</span><span class="s2">"xxx"</span>
  19. <span class="c">#指定image和ipa最后路径</span>
  20. <span class="nv">ipa_path</span><span class="o">=</span><span class="s2">"</span><span class="nv">$project_path</span><span class="s2">/xx.ipa"</span>
  21. <span class="c">#上传team_id</span>
  22. <span class="nv">team_id</span><span class="o">=</span><span class="s2">"xxxx"</span>
  23. <span class="c">#上传team_name</span>
  24. <span class="nv">team_name</span><span class="o">=</span><span class="s2">"xxx"</span>
  25. <span class="c">#上传dev_portal_team_id</span>
  26. <span class="nv">dev_portal_team_id</span><span class="o">=</span><span class="s2">"xxx"</span>
  27. <span class="c">#上传itc_provider</span>
  28. <span class="nv">itc_provider</span><span class="o">=</span><span class="s2">"xxx"</span>
  29. <span class="nv">distribute_external</span><span class="o">=</span><span class="nv">$1</span>
  30. <span class="nv">changelog</span><span class="o">=</span><span class="s2">"xxxx"</span>
  31. <span class="nv">beta_app_description</span><span class="o">=</span><span class="s2">"xxxx"</span>
  32. <span class="c">#反馈邮箱</span>
  33. <span class="nv">email</span><span class="o">=</span><span class="s2">"xxxx"</span>
  34. <span class="nv">group</span><span class="o">=</span><span class="nv">$2</span>

  35. <span class="k">if</span> <span class="o">[</span> -z <span class="s2">"</span><span class="nv">$2</span><span class="s2">"</span> <span class="o">]</span>; <span class="k">then
  36.     </span><span class="nv">group</span><span class="o">=</span><span class="s2">"xxx"</span>
  37. <span class="k">fi</span>
  38. <span class="c">#执行上传testflight</span>
  39. pilot upload --verbose --username <span class="k">${</span><span class="nv">username</span><span class="k">}</span> --app_identifier <span class="k">${</span><span class="nv">bundle_id</span><span class="k">}</span>
  40. --changelog <span class="k">${</span><span class="nv">changelog</span><span class="k">}</span> -d <span class="k">${</span><span class="nv">beta_app_description</span><span class="k">}</span>
  41. --ipa <span class="k">${</span><span class="nv">ipa_path</span><span class="k">}</span> --distribute_external <span class="k">${</span><span class="nv">distribute_external</span><span class="k">}</span>
  42. --apple_id <span class="k">${</span><span class="nv">apple_id</span><span class="k">}</span> --team_id <span class="k">${</span><span class="nv">team_id</span><span class="k">}</span>
  43. --team_name <span class="s2">"</span><span class="k">${</span><span class="nv">team_name</span><span class="k">}</span><span class="s2">"</span> --dev_portal_team_id <span class="k">${</span><span class="nv">dev_portal_team_id</span><span class="k">}</span>
  44. --itc_provider <span class="s2">"</span><span class="k">${</span><span class="nv">itc_provider</span><span class="k">}</span><span class="s2">"</span> --beta_app_feedback_email <span class="s2">"</span><span class="k">${</span><span class="nv">email</span><span class="k">}</span><span class="s2">"</span> | <span class="nb">exit</span>

  45. <span class="c">#输出总用时</span>
  46. <span class="nb">echo</span> <span class="s2">"===Finished. Total time: </span><span class="k">${</span><span class="nv">SECONDS</span><span class="k">}</span><span class="s2">s==="</span>
复制代码
脚本中的例如team_id等这些值,对于开发或者测试来说应该都不陌生,虽然脚本简单,但是能方便的上传TestFlight,并且分发外部测试,真的非常方便。

最后集成到jenkins,可以看到结果:


看到箭头指示的出现,代表已经成功的分发测试,可以去Testflight app下载安装新版本了。

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    无聊
    2024-9-19 09:07
  • 签到天数: 11 天

    连续签到: 2 天

    [LV.3]测试连长

    2#
    发表于 2017-6-15 13:26:16 | 只看该作者
    学习,很详细!
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2017-6-15 13:28:36 | 只看该作者
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-25 16:19 , Processed in 0.065623 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表