Help
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Highlighted
Copilot Lvl 3
Message 1 of 9

GitHub Actions running iOS app using xcodebuild

Hi Everyone ๐Ÿ‘‹

 

Iโ€™m trying to run iOS tests using xcodebuild on macOS-10.14. But for some reason all I can get is error like this:

 

xcodebuild: error: Unable to find a destination matching the provided destination specifier:

{ platform:iOS Simulator, OS:latest, name:iPhone X }

 

My workflow is defined here https://github.com/mikina/TodoSampleApp/blob/master/.github/workflows/test.yml

 

Iโ€™ve tried a lot of different destination settings, all of them ends up with this error.

 

I got list of devices by running:

 

xcrun instruments -s devices

 

Results here: https://github.com/mikina/TodoSampleApp/commit/7bead23b21eea9e27c093b8d1b9657a9dd90d570/checks

 

Xcode version: Xcode 10.2.1 https://github.com/mikina/TodoSampleApp/commit/12bd22aa9b1288470c3d99d19286f7798c6f3ac9/checks

 

I also checked xcrun simctl list

Results here: https://github.com/mikina/TodoSampleApp/commit/89b06dfa944b8f59892cdaadfdf7ea08c3edb528/checks

 

Anyone tried and succeeded running tests for iOS app on GitHub actions?

8 Replies
Highlighted
GitHub Staff
Message 2 of 9

Re: GitHub Actions running iOS app using xcodebuild

This works for me:

 

 - name: Test
      run: |
        xcodebuild test -project Proj.xcodeproj -scheme ProjTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6,OS=12.2"

What I haven't done is a proper build, which will be trickier thanks to provisioning profiles and distribution certificates.  (Isn't that always the way?)

Highlighted
Copilot Lvl 3
Message 3 of 9

Re: GitHub Actions running iOS app using xcodebuild

Thanks for the help. Unfortunately itโ€™s not working for me, even with the same destination values and same parameters as yours.

Highlighted
Copilot Lvl 2
Message 4 of 9

Re: GitHub Actions running iOS app using xcodebuild

I have my GitHub actions running iOS tests on the CI as of the past week. It took some finessing... but I got it. It looks like your post is missing the "platform" keyword at least, did you figure it out? 

 

Anyway, in case anyone comes here from Google (like I did) here's a full working copy of my iOS script!! Should save you a few hours / days of sleuthing like I had to conjure this together. 

 

name: CI

on: [push]

jobs:
build:

runs-on: macOS-latest

steps:
- name: Checkout
uses: actions/checkout@v1
- name: CocoaPod Install
run: pod install
#- name: Testing....
# run: ls /Applications | grep Xcode
- name: Force xcode 11
run: sudo xcode-select -switch /Applications/Xcode_11.3.app
- name: iPhone 11 Test
run: xcodebuild test -scheme affirm-me-test -workspace affirm-me.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.3'

Highlighted
Copilot Lvl 3
Message 5 of 9

Re: GitHub Actions running iOS app using xcodebuild

I haven't checked it for a while, looks like Github must have changed something, almost all of my previous configuration works right now ๐Ÿ˜

Highlighted
Copilot Lvl 2
Message 6 of 9

Re: GitHub Actions running iOS app using xcodebuild

I'm having the same issues you were originally having.  is it still working for you?

Highlighted
Copilot Lvl 3
Message 7 of 9

Re: GitHub Actions running iOS app using xcodebuild

Yes, this one is working fine:

 

xcodebuild clean test -project TodoSampleApp.xcodeproj -scheme TodoSampleApp -destination "platform=iOS Simulator,name=iPhone 11 Pro"

Here is the yml file: https://github.com/mikina/TodoSampleApp/blob/master/.github/workflows/test.yml

Highlighted
Ground Controller Lvl 2
Message 8 of 9

Re: GitHub Actions running iOS app using xcodebuild

@jfb8618 Thanks for your post. I was having the same issue but after trying your `Force xcode 11` part it worked for me. I did update it to Xcode_11.3.app though.

Highlighted
Copilot Lvl 2
Message 9 of 9

Re: GitHub Actions running iOS app using xcodebuild

Great glad it was helpful! I updated the post with xcode 11.3 / ios 13.3. Basically yea as Apple release new tools, you just slightly mod the script to adapt. You shouldn't rely on Github setting their default instance to the latest Xcode, since it'll likely always lag behind many months. This will be worse in June-Sept when each new OS / iOS mega version comes out. so being explicit keeps everything running smooth! 

 

For anyone else who happens on this thread, I have a pull request that hasn't merged but it has the full script with lots of options here.

https://github.com/actions/starter-workflows/pull/172