我有一个用Swift编写的repository,它是一个标准的cocoapod工作区(标准格式,其中包含使用Quick和Nimble测试创建的示例应用程序,没有UI测试),该工作区基于我的本地计算机(Xcode 11.2.1,macOS Catalina 10.15.1)运行顺利,但是Travis CI构建失败,并出现以下错误:模块之一不存在:
/Users/travis/build/Kentico/kontent-delivery-sdk-swift/Example/KenticoKontentDelivery/KontentModels/Cafe.swift:9:8: no such module 'ObjectMapper'
完整的Travis CI日志here。
.podspec文件:
Pod::Spec.new do |s|
s.name = 'KenticoKontentDelivery'
s.version = '2.0.0'
s.summary = 'Swift SDK for Kentico Kontent Delivery'
s.description = <<-DESC
Swift SDK for Kentico Kontent Delivery.
DESC
s.homepage = 'https://github.com/kentico/kontent-delivery-sdk-swift'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'makma' => 'martinmakarsky@gmail.com' }
s.source = { :git => 'https://github.com/kentico/kontent-delivery-sdk-swift.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/kenticokontent'
s.ios.deployment_target = '8.0'
s.source_files = 'KenticoKontentDelivery/Classes/**/*'
s.dependency 'AlamofireObjectMapper', '~> 5.2.0'
s.dependency 'ObjectMapper', '~> 3.5.1'
s.dependency 'Kanna', '~> 4.0.2'
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }
end
use_frameworks!
platform :ios, '12.0'
target 'KenticoKontentDelivery_Example' do
pod 'KenticoKontentDelivery', :path => '../'
pod 'AlamofireImage', '~> 3.6.0'
pod 'ObjectMapper', '~> 3.5.1'
pod 'AlamofireObjectMapper', '~> 5.2.0'
target 'KenticoKontentDelivery_Tests' do
inherit! :search_paths
pod 'Quick', '~> 2.2.0'
pod 'Nimble', '~> 7.0'
pod 'ObjectMapper', '~> 3.5.1'
pod 'AlamofireObjectMapper', '~> 5.2.0'
end
end
osx_image: xcode11.1
language: objective-c
cache: cocoapods
podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod repo update
- pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/KenticoKontentDelivery.xcworkspace -scheme KenticoKontentDelivery-Example -sdk iphonesimulator -destination 'name=iPhone 8' ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
provider: script
script: sh ./scripts/push.sh
skip_cleanup: true
on:
tags: true
我尝试过的:
答案 0 :(得分:0)
我终于调整了设置,以便能够在Travis CI上成功运行。我不确定哪个设置会影响结果,但是,在进行了这些更改之后,构建和测试将顺利进行。
IPHONEOS_DEPLOYMENT_TARGET
降级为版本11 platform :ios, '11.0'
中设置Podfile
s.ios.deployment_target = '11.0'
中设置.podspec
s.swift_versions = '5.0'
.swift-version
文件