我想在 gitlab-ci 上对多个 iOS 版本执行相同的测试作业。
我的测试工作由以下命令组成:
xcodebuild test -workspace myproject.xcworkspace -scheme myScheme -destination 'platform=iOS Simulator,name=iPhone 6S,OS=9.3'
Run Code Online (Sandbox Code Playgroud)
是否可以创建一种循环来为不同的操作系统版本和 iPhone/iPad 执行此命令?
例如,进行 xcodebuild 测试:
谢谢
Mas*_*oob 15
对于版本> = 13.5,您可以使用并行:矩阵与值并行执行作业多次。
对于你的例子:
Test:ios:
stage: test
script:
- xcodebuild test -workspace myproject.xcworkspace -scheme myScheme -destination 'platform=iOS Simulator,name=${DEVICE},OS=${VERSION}'
parallel:
matrix:
- DEVICE: 'iPhone 6'
VERSION: ['9.3', '10.0']
- DEVICE: 'iPhone 7'
VERSION: ['10.0']
- DEVICE: 'iPad Mini'
VERSION: ['8.2', '9.3']
Run Code Online (Sandbox Code Playgroud)
使用 gitlab-citemplate并定义一个包含模拟器名称的变量,例如,使用 iPhone 5S:
# Job
.test_ios_job: &test_ios_job_def
stage: test_ios
script:
- xcodebuild test -workspace myproject.xcworkspace -scheme myScheme -destination 'platform=iOS Simulator,name=$SIMULATOR'
# iPhone 5S
test_ios_iPhone5S_9.1:
<<: *test_ios_job_def
variables:
SIMULATOR: "iPhone 5S,OS=9.1"
test_ios_iPhone5S_10.1:
<<: *test_ios_job_def
variables:
SIMULATOR: "iPhone 5S,OS=10.1"
Run Code Online (Sandbox Code Playgroud)
我建议使用fastlane, 插件scan来简化工作:
# Job
.test_ios_job: &test_ios_job_def
stage: test_ios
script:
- fastlane testios emulatorname:"$SIMULATOR"
test_ios_iPhone5S_9.1:
<<: *test_ios_job_def
variables:
SIMULATOR: "iPhone 5s (9.1)"
test_ios_iPhone5S_10.1:
<<: *test_ios_job_def
variables:
SIMULATOR: "iPhone 5s (10.1)"
Run Code Online (Sandbox Code Playgroud)
快车道工作:
lane :testios do |options|
emulatorname = options[:emulatorname]
#Scan
scan(
scheme: S_APP_SCHEME_TEST,
clean: true,
device: "#{emulatorname.to_s}",
)
end
Run Code Online (Sandbox Code Playgroud)
X.J*_*ian -5
使用阶段:
stages:
- buildForiPhone
- buildForiPad
build_project:
stage: buildForiPhone
script:
- xcodebuild for iPhone here
tags:
- Swift
- iOS9
build_project:
stage: buildForiPad
script:
- xcodebuild for iPad here
tags:
- Swift
- iOS9
Run Code Online (Sandbox Code Playgroud)
一个 build_project一阶段,他们是
isolated。
| 归档时间: |
|
| 查看次数: |
8762 次 |
| 最近记录: |