Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-install main iOS Simulators for all Xcode versions #551

Closed
1 task done
maxim-lobanov opened this issue Mar 13, 2020 · 14 comments
Closed
1 task done

Pre-install main iOS Simulators for all Xcode versions #551

maxim-lobanov opened this issue Mar 13, 2020 · 14 comments

Comments

@maxim-lobanov
Copy link
Contributor

maxim-lobanov commented Mar 13, 2020

Tool information

  • Tool name: iOS Simulators
  • Add or update? Add
  • Approximate size:
  • If this is an add request:
    • Brief description of tool:
    • URL for tool's homepage:

Context
For now only default iOS simulators are installed on macOS images. The list of pre-installed simulators is located in macOS High Sierra docs and macOS Mojave docs.

Sometimes customers need to use non-default simulators (like iOS 11 simulators for Xcode 10.3). For now they have to use xcversion tool to install those simulators during the build. It takes some time and it would be great to pre-install some simulators for all Xcode versions.

Suggestion
Pre-install the latest minor version of each major version of Xcode (like 10.3.2, 11.4).
This issue was created to track customers' interest for this feature.

Area for Triage:
Apple

Question, Bug, or Feature?:
Feature request

Virtual environments affected

  • macOS 10.15

Can this tool be installed during the build?
The command xcversion simulators --install='iOS <VERSION>' can be used to install specific simulator for all Xcode versions.

@maxim-lobanov
Copy link
Contributor Author

Move the work item from https://github.com/microsoft/azure-pipelines-image-generation/issues/1199 because it is very popular and it is something that we would like to consider in future

@manuyavuz-pointr
Copy link

Hi,

Are there any updates on this?

https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md#installed-simulators

According to above list, macos image only has iOS 13 as major version, which is pretty limited imo.

Do you have any plan on maintaining additional previous major versions?

Thanks

@b-onc
Copy link

b-onc commented Apr 30, 2020

We're also in need of this. Currently, installing the simulators take too long.

@svenmuennich
Copy link

A workaround we found is to symlink any simulators from the Xcode bundles they are part of to /Library/Developer/CoreSimulator/Profiles/Runtimes, which is where Xcode also installs additional runtimes.

So based on the this list of simulators an iOS 12.4 device can be added as follows:

- name: Prepare iOS 12 simulator
  run: |
    sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
    sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 12.4.simruntime
    xcrun simctl list runtimes
    xcrun simctl create custom-test-device "iPad Pro (9.7-inch)" "com.apple.CoreSimulator.SimRuntime.iOS-12-4"
    xcrun simctl list devices 12.4

@dmitry-shibanov
Copy link
Contributor

dmitry-shibanov commented Aug 5, 2020

Hello, we have investigated provided workaround with symlink simulators to CoreSimulator directory and it works without drawbacks.
To use specific simulator with any Xcode, you should

  1. Find Xcode where this simulator is installed
  2. Create symlink using the following command
  • For Xcode > 10.3
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
<XCODE_PATH>/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ <IOS_VERSION>.simruntime
  • For Xcode 10.3
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 12.4.simruntime

@erisu
Copy link

erisu commented Sep 4, 2020

I am also in favor of preinstalling the latest minor version of each major version of Xcode.

I have been trying to find a way to test on an iOS 11 simulator but the versions of Xcode that are bundled do not have iOS 11 Simulator pre-packaged. Maybe the xcversion simulators command will do the trick but I think downloading 2gb on each run is not efficient. Maybe I could also look into caching the downloaded simulator so on consecutive runs it will just use the cached simulator.

Even though the iPhones that had iOS 11 initially are discontinued, they are still supported. I believe it would be nice to still include iOS 11 in a test matrix until the phones are no longer supported.

@kylebshr
Copy link

We'd like to move to Github Actions on the Blueprint repo, but we need to run our tests using the latest version of Xcode on simulators for iOS 10, 11, 12, 13 and 14. While it seems like we can set up an iOS 12 and 13 simulator, there's no way to install an iOS 10 or 11 one. We would definitely appreciate a way to install those, as well as an easier way to set up versions other than the primary version shipped with the Xcode version.

@kyleve
Copy link

kyleve commented Dec 9, 2020

Going to +1 this as well – our tests run on Xcode 12, but we deploy back to iOS 11 – so we need the sim runtimes of 14, 13, 12, and 11 installed to feasibly be able to use Github actions.

My understanding is that these runtimes just need to be installed once when prepping the Xcode version image – and then everyone will be able to use them.

@AlenaSviridenko
Copy link
Contributor

Hi folks,
after long and hot internal discussions, we come up to a conclusion to not install additional simulators due to several reasons:

  1. Workaround provided in this comment allows using simulators of different Xcode versions without any noticeable build time increase.
  2. We cannot afford to install more simulators for each Xcode due to maintenance, image generation time and image space concerns.

I am closing this issue, please, feel free to contact us in case of any other questions.
Thank you.

@zeeshankhan
Copy link

Hey folks,
I'm trying to build my workspace but it is failing with
xcodebuild: error: Unable to find a destination matching the provided destination specifier:

Screen Shot 2021-08-26 at 7 18 51 PM

I tried the above workaround and I'm able to list the runtime simulator. I must be missing something here. Please let me know if you find any missing peace or what am I doing wrong.
Thanks a lot.

Screen Shot 2021-08-26 at 7 17 24 PM

@skyflow-tejesh-reddy
Copy link

We are facing the same issue as above. @zeeshankhan were you able to find a solution to this?

@couchdeveloper
Copy link

couchdeveloper commented Nov 21, 2021

Dear @maxim-lobanov

During evaluation of GitHub Actions for our app, I ran in to the situation that on macOS-11 runner, only iOS 15 version is available in the simulators.

Xcode ships simulators only with the newest iOS versions. However, for testing it is absolutely crucial to have simulators for several major versions of iOS on each runner:

In practice it is never the case, that an App will only be deployed to the AppStore which runs only on the newest iOS version. The code to test can have several iOS version availability constraints. Some code only runs on the newest iOS versions, some other uses a fallback when run on older versions. So, we have to test this.

Having to install the simulators with the iOS versions required for testing, simply takes too long and is no option, not even a temporary solution. So, for us, this is a bummer!

So, we would be very happy if there will be a couple more iOS Simulators preinstalled on the runners. I would suggest to install the latest version for every major version which are available in the Simulator, for example, 13.6, 14.5, and 15.0.

Also, the suggested workaround does not work in my case:
I created this script:

#!/usr/bin/env bash
set -ueo pipefail

sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
sudo ln -s /Applications/Xcode_12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 14.4.simruntime
xcrun simctl list runtimes
xcrun simctl create "iPhone 8" "com.apple.CoreSimulator.SimRuntime.iOS-14-4"
xcrun simctl list devices 14.4

which will be called in the action:

jobs:
  build:

    runs-on: macos-11
    steps:
    - uses: actions/checkout@v2
    - name: Prepare iOS 14 simulator
      run: Scripts/prepareSimulators.sh
    - name: BuildAndTest
      run: Scripts/build.sh clean build test

which then exits with a failure:

Run Scripts/prepareSimulators.sh
4 == Runtimes ==
5 iOS 14.4 (14.4 - 18D46) - com.apple.CoreSimulator.SimRuntime.iOS-14-4
6 iOS 15.0 (15.0 - 19A339) - com.apple.CoreSimulator.SimRuntime.iOS-15-0
7 tvOS 15.0 (15.0 - 19J344) - com.apple.CoreSimulator.SimRuntime.tvOS-15-0
8 watchOS 8.0 (8.0 - 19R345) - com.apple.CoreSimulator.SimRuntime.watchOS-8-0
9 Invalid device type: com.apple.CoreSimulator.SimRuntime.iOS-14-4
10 Error: Process completed with exit code 146.

Note:

The path to iOS.simruntime is different on different Xcode versions!
Furthermore, an additional weirdness is that the bundle "iOS.simruntime" has a version which is different than what xcrun simctl list runtimes reports:
The bundle version is 14.5, and simctl lists version "14.4".
The attempt to set
xcrun simctl create "iPhone 8" "com.apple.CoreSimulator.SimRuntime.iOS-14-5"
fails as well.

As it turns out, there are too many subtleties with this workaround.
I haven't participated in the "long and hot discussion", but for sure, the result was not satisfying.

So, this Issue should be reopened, and a viable solution should be found.

@svenmuennich
Copy link

xcrun simctl create "iPhone 8" "com.apple.CoreSimulator.SimRuntime.iOS-14-4"

xcrun simctl create takes up the three arguments, where the runtime is the optional third argument. The second argument must be a device type identifier (can be listed via xcrun simctl list devicetypes). So for an iPhone 8 running iOS 14.4 the command would have to look as follows:

xcrun simctl create "iPhone 8" "com.apple.CoreSimulator.SimDeviceType.iPhone-8" "com.apple.CoreSimulator.SimRuntime.iOS-14-4"

@jshier
Copy link

jshier commented Jan 23, 2022

Hi folks, after long and hot internal discussions, we come up to a conclusion to not install additional simulators due to several reasons:

  1. Workaround provided in this comment allows using simulators of different Xcode versions without any noticeable build time increase.
  2. We cannot afford to install more simulators for each Xcode due to maintenance, image generation time and image space concerns.

I am closing this issue, please, feel free to contact us in case of any other questions. Thank you.

It's increasingly clear that GitHub's current approach isn't sustainable and doesn't track how customers actually want to use the product, so the single OS images should be abandoned. Instead, GitHub should follow the approach of various other CI vendors and create Xcode versioned images. This increases the number of images but allows each to fully represent the capabilities of the Xcode version it contains. All simulators, the latest compatible tools, everything. Otherwise GitHub's macOS will continue becoming less and less competitive as the overall size of the image forces more and more compromise on the version of tools installed.

philipphofmann added a commit to getsentry/sentry-cocoa that referenced this issue Oct 24, 2022
GH actions will remove the macOS-10.15 image, which contains an iOS 12 simulator on 12/1/22; see actions/runner-images#5583. Neither the[ macOS-11](https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md#installed-sdks) nor the [macOS-12](https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#installed-sdks) image contains an iOS 12 simulator. GH [concluded](actions/runner-images#551 (comment)) to not add more pre-installed simulators. SauceLabs doesn't support running unit tests and adding another cloud solution as Firebase TestLab would increase the complexity of CI. Not running the unit tests on iOS 12 opens a risk of introducing bugs, which has already happened in the past, especially with swizzling. Therefore, we give manually installing the iOS 12 simulator a try.

Fixes GH-2218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests