App Center

Uploading an iOS simulator build is not officially supported in App Center. However, we have found a usable workaround that accomplishes just that. Multiple Waldo customers have implemented this solution until such time as App Center provides official support for simulator builds.

This solution “piggybacks” a simulator build on top of a regular device build. It requires you only to add a couple of custom build scripts.

Step 1

First, add the following to appcenter-post-clone.sh:

export WALDO_CLI_BIN=/usr/local/bin

bash -c "$(curl -fLs https://github.com/waldoapp/waldo-go-cli/raw/master/install-waldo.sh)"

Note: This downloads a special Bash script, sim_appcenter_build_and_upload.sh, in addition to the waldo executable binary.

Step 2

Then, add the following to appcenter-pre-build.sh (making sure to supply the appropriate values to the environment variables):

WALDO_CLI_BIN=/usr/local/bin

export SIM_XCODE_PROJECT=YourApp.xcodeproj  # or YourApp.xcworkspace
export SIM_XCODE_SCHEME=YourApp
export SIM_XCODE_CONFIGURATION=Release      # or equivalent
export SIM_XCODE_APP_NAME=YourApp.app

export WALDO_UPLOAD_TOKEN=<<waldoUploadToken>>

#
# Uncomment and define the following environment variable if you need to pass
# extra options (for example, `--git_branch` or `--git_commit`) to the
# underlying `waldo upload` invocation:
#
# export SIM_WALDO_UPLOAD_OPTIONS="--git_branch ${YOUR_GIT_BRANCH} --verbose"

#
# Uncomment and define the following three environment variables to disable the
# device build operation from running and display as “Canceled” in the App
# Center dashboard:
#
# export SIM_APPCENTER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
# export SIM_APPCENTER_OWNER_NAME="Owner Name"
# export SIM_APPCENTER_APP_NAME=YourApp

${WALDO_CLI_BIN}/sim_appcenter_build_and_upload.sh || exit

#
# Uncomment the following “exit” line to disable the device build operation
# from running and display as “Failed” in the App Center dashboard:
#
# exit 1

Note: You can also set environment variable SIM_XCODE_PROJECT to $APPCENTER_XCODE_PROJECT and SIM_XCODE_SCHEME to $APPCENTER_XCODE_SCHEME.

Details

The SIM_APPCENTER_* environment variables enable the helper script to cancel the App Center build after the simulator build uploads to Waldo, but before the regular (and expensive) device build operation starts. If you choose to not set these environment variables, the simulator build will still upload the simulator build to Waldo. What happens afterward depends on whether you exit the pre-build script with success (0) or failure (not 0).

Thus, there are three options you can choose for the pre-build script:

  1. normal (default) — Leave the SIM_APPCENTER_* environment variables and the exit line commented out. This will upload a simulator build of your app to Waldo and then proceed to build it for device, too. The entire build will display as Succeeded in the App Center dashboard.

  2. cancel — Uncomment and define the SIM_APPCENTER_* environment variables (leave the exit line commented out). This will upload a simulator build of your app to Waldo and then cancel the device build. The entire build will display as Canceled in the App Center dashboard.

    The sim_appcenter_build_and_upload.sh script calls an App Center API endpoint to cancel the device build. Therefore, you must define the following environment variables correctly in order to cancel the device build:

  3. failure — Uncomment the exit line (leave the SIM_APPCENTER_* environment variables commented out). This will upload a simulator build of your app to Waldo and then fail the device build. The entire build will display as Failed in the App Center dashboard.

We strongly recommend that you choose option 2 unless you actually desire the device build operation to be run. In this way, the build displays a Canceled status, and thereby reserves the Failed status for true build failures.