【问题标题】:GitHub Action in swift workspace快速工作区中的 GitHub 操作
【发布时间】:2020-01-21 19:40:06
【问题描述】:

我正在尝试使用 Github Actions 在我的 xcworkspace 上运行 xcodebuild 命令。 但是,任何配置都会失败并出现错误Unable to find a destination matching the provided destination specifier: { platform: iOS Simulator, OS: latest, name:iPhone 11 Pro }

这是我的swift.yml 文件

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"

如您所见,我还在 CI 机器上记录所有可用设备。这清楚地向我展示了几部 iPhone 11 Pro (Max)。

我已经尝试过的事情:

  • 使用特定的操作系统版本
  • 降低构建目标
  • 强制 Xcode 版本为 11.3
  • grep 上述列表中的模拟器 ID 并使用该 ID 代替 name 参数
  • 在运行测试之前启动模拟器

我错过了什么明显的东西吗?

干杯,编码愉快。

【问题讨论】:

    标签: swift xcodebuild github-actions xcode-workspace


    【解决方案1】:

    强制 Xcode 版本为 Xcode 11.3clean 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'
    

    【讨论】:

    • 试过了。错误消息是“方案未配置为操作 clean”(不要引用我的话,稍后会再次查看确切消息),如果我删除 clean,它会退回到上一个错误消息
    猜你喜欢
    • 2020-03-03
    • 2021-07-25
    • 2019-12-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 2018-02-01
    • 2011-12-20
    相关资源
    最近更新 更多