我有一个针对 iOS 应用运行测试的 GitHub 操作。该操作如下所示:名称:Testson:[pull_request]jobs:build:runs-on:macos-latest 步骤:- 使用:actions/check...
我有一个针对 iOS 应用运行测试的 GitHub 操作。该操作如下所示:
name: Tests
on: [pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: xcodebuild clean test -workspace "xxx.xcworkspace" -scheme "xxx" -destination "platform=iOS Simulator,name=iPhone 12 Pro,OS=latest" | xcpretty && exit ${PIPESTATUS[0]}
最近我开始收到此错误,阻止 CI 运行:
No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "xxxx" with a private key was found.
No profiles for 'com.xxx.xxx.xxx-iosUITests.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.xxx.xxx.xxxUITests.xctrunner'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
No profiles for 'xxx.xxx.xxx' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'xxx.xxx.xxx'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Testing cancelled because the build failed.
我以前从未提供过签名证书来在 CI 中运行测试。我 xcodebuild
在本地运行时遇到同样的错误,但我可以在 Xcode 内部顺利运行测试。我该如何修复 CI?
经过多次尝试和错误,我发现更改我测试的 iPhone 的名称可以解决问题。现在的操作如下:
name: Test
on: [pull_request]
jobs:
test:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Run Tests
run: xcodebuild test -workspace "xxx.xcworkspace" -scheme "xxx" -destination "name=iPhone 15 Pro" | xcpretty && exit ${PIPESTATUS[0]}
但唯一重要的变化是从 iPhone 12 变成 iPhone 15。