Uni*_*eas 6 continuous-integration xcodebuild ios swift github-actions
我正在尝试使用 GitHub Actions 在 Github 中为我的私有 Swift 项目设置 CI。我使用了 Github 提供的标准 swift.yml 模板并进行了一些修改。这是文件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
Run Code Online (Sandbox Code Playgroud)
当我将新版本推送到存储库时,操作会触发,但测试失败。
xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest' clean test
Run Code Online (Sandbox Code Playgroud)
我在本地运行并且所有测试都通过了。在 GitHub Actions 上,我遇到了此错误
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
Run Code Online (Sandbox Code Playgroud)
这个测试应该会通过。我不知道如何解决这个问题,以便操作不再失败
我能够通过强制使用 Xcode 11 来修复此错误。我使用以下代码使其工作。现在所有测试都已通过并且一切正常。
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3923 次 |
| 最近记录: |