Search code examples
ioscontinuous-integrationtestflight

iOS TestFlight CI, automate the beta "waiting" process?


Say you upload build 1192...

After waiting for some time, you get the email....

enter image description here

Only then you then finally see the following, on the itunesconnect.apple.com web site...

enter image description here

You can then at last click "Add groups to this build", and ultimately click "submit for review".

My question: is there a way to automate the waiting - to know when it is available to submit?

Thus,

  1. Is there any way - other than watching for the email - to automate "knowing it has completed processing"? Example, does Apple send out the info on the API version, or something? Or is the email in fact the one and only way to know?

  2. If no, are there any existing systems which either hijack your email or perhaps poll the server / an API / whatever, to know when "processing is completed"?

Once again, the specific questions here are...

  1. Is there any way to know (api? message? other communication?) that it has completed processing?

  2. If no, if there perhaps an existing system that watches email / polls to know?


Solution

  • Sounds like Fastlane's pilot action is what you need:

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

    Based on the docs this would probably do what you need: generate the ipa you want to submit, then on the directory the iap is in run:

     fastlane pilot upload
    

    It uploads the ipa in the current directory, waits the validation and distributes it to testers. There is also other commands to add or remove testers, and parameters to set the descriptions and stuff. You can check all the options with fastlane action pilot


    Fastlane can take care of everything so if you want you can setup a lane that builds and submits the app to TestFlight with a Fastfile like this (you'll very have to tweak this to your project's specific needs):

      default_platform :ios
    
      platform :ios do
    
      desc "Submit a new Beta Build to Apple TestFlight"
      lane :beta do    
        #increment_build_number
        gym(scheme: "Your Scheme”) # Build your app - more options are available
    
    
        pilot # upload your app to TestFlight
    
        # You can do much more run `fastlane actions` to see all the actions
      end
    

    Whenever you want a new build you can just run: fastlane beta.


    Edit: How They Wait For It?

    Using Spaceship to poll iTunes Connect (not nice API, they do web scraping on the pages) and check - in a loop every X seconds - if the processing is done.

    Fastlane has a simpler action called watchbuild that its only job is to notify when processing is done. Check the source code for an example on how to use Spacechip: https://github.com/fastlane/watchbuild/blob/master/lib/watchbuild/runner.rb