简体   繁体   中英

Fastlane iOS tests pass locally but not from Jenkins

I have some trouble with Fastlane execution on Jenkins. Locally it works, build succeed and tests run. But from Jenkins and github, the build don't succeed. I think it's because of this line :

PhaseScriptExecution Run\ Script /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyProject-bljizzbrhfznjpgjucmtarcsjmyw/Build/Intermediates.noindex/MyProject.build/Debug-iphonesimulator/Core.build/Script-FC957A9020120D68000F4790.sh

But not focus on that, I'm not sure that's it.

Here the Fastfile :

default_platform(:ios)

platform :ios do
desc "Launch Middleware tests"
lane :tests do
  run_tests(workspace: "MyProject.xcworkspace",
            clean: true,
            devices: ["iPhone 8"],
            scheme: "Middleware",
            slack_url: "https://hooks.slack.com/services/...",
            slack_channel: "#myChannel")
  end
end

Some environment variables set 环境变量

The Build action : 建立行动

The jenkins error 詹金斯错误

The command created by fastfile and executed by Jenkins

Fastlane命令

I found the answer, it appears that is that script : Script-FC957A9020120D68000F4790.sh, I was using sourcery before Swift 4.

${PODS_ROOT}/Sourcery/bin/sourcery --sources ${PROJECT_DIR}/Core --templates ${PROJECT_DIR}/Sourcery/Core/Templates --output ${PROJECT_DIR}/Core/Sourcery/

Jenkins was not able to find PODS_ROOT and PROJECT_DIR environment variables. I don't use sourcery anymore so, I commented that script but if you still use it, I think you can add environment variables to jenkins configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM