GitHub Action in swift workspace

908 views Asked by At

I am trying to use Github Actions to run an xcodebuild command on my xcworkspace. However, any configuration fails with the error Unable to find a destination matching the provided destination specifier: { platform: iOS Simulator, OS: latest, name:iPhone 11 Pro }

Here is my swift.yml file

name: Unit Tests
on: [push]
jobs:
  test:

  runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: List Simulators
  run: xcrun instruments -s
- name: Run tests
  run: xcodebuild test -workspace "MyWorkspace.xcworkspace" -scheme "MyScheme" -destination "platform=iOS Simulator,name=iPhone 11 Pro,OS=latest"

As you can see, I am also logging all available devices on the CI machine. This clearly shows me several iPhone 11 Pro (Max).

Things I already tried:

  • use specific OS version
  • lower build target
  • force Xcode version to 11.3
  • grep ID of a simulator from the above-mentioned list and use that instead of the name parameter
  • boot simulators before running tests

Am I missing anything obvious?

Cheers and happy coding.

1

There are 1 answers

1
byaruhaf On

Force Xcode version to Xcode 11.3 and clean test

name: Unit Tests
on: [push]
jobs:
  test:

  runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: Force Xcode 11
  run: sudo xcode-select -switch /Applications/Xcode_11.3.app
- name: List Simulators
  run: xcrun instruments -s
- name: Run tests
  run: xcodebuild clean test -workspace 'MyWorkspace.xcworkspace' -scheme 'MyScheme' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest'