Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error with xcodebuild in GitHub Actions

I'm trying to setup a CI with my private Swift project in Github using GitHub Actions. I've used the standard swift.yml template provided by Github with some modifications. Here is the file ci.yml

name: Swift

on: [push]

jobs:
  build:

    runs-on: macOS-latest

    steps:
    - uses: actions/checkout@v1
    - name: Run tests
      run: xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.2' clean test
    - name: Build App
      run: xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'generic/platform=iOS' -configuration Release build CODE_SIGNING_ALLOWED=NO

When I push a new build to the repo the action triggers but it is failing at the test.

xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest' clean test

I ran locally and all tests pass. On GitHub Actions I'm presented with this error

Set up job                  0s
Run actions/checkout@v1     2s
Run tests                   34s
    ##[error]Process completed with exit code 70.
1     Run xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.2' clean test
4        xcodebuild: error: Unable to find a destination matching the provided destination specifier:
5             { platform:iOS Simulator, OS:13.2, name:iPhone 11 Pro Max }
6
9        Ineligible destinations for the "MyApp" scheme:
10           { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
11           { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
12    ##[error]Process completed with exit code 70.
Build App                   0s
Complete job

This test should be passing. I'm not sure how to fix this an move forward so the Action no longer fails

like image 560
Unipheas Avatar asked Dec 25 '19 08:12

Unipheas


1 Answers

I was able to fix this error by forcing Xcode 11. I used the following code to make it work. All tests are now passing and everything works.

name: Swift

on: [push]

jobs:
  build:

    runs-on: macOS-latest

    steps:
    - uses: actions/checkout@v1
    - name: Force Xcode 11
      run: sudo xcode-select -switch /Applications/Xcode_11.3.app
    - name: Run tests
      run: xcodebuild clean test -project "MyApp.xcodeproj" -scheme "MyApp" -destination "platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest"
    - name: Build App
      run: xcodebuild -project "MyApp.xcodeproj" -scheme "MyApp" -destination "generic/platform=iOS" -configuration Release build CODE_SIGNING_ALLOWED=NO

like image 133
Unipheas Avatar answered Nov 12 '22 08:11

Unipheas