I have just confronted a rather annoying problem for which I have not found good explanations. I take the opportunity to give you feedback about very long build on travis, and how to speed up.
For those who don't know Travis is a CI tool. In this case, I use it to build the open-source projects of the community available on Github. I encountered a problem on the Swift repo currently in Alpha (I hope to get it out quickly).
- Travis includes a build timeout of 50 minutes in OpenSource : The job exceeded the maximum time limit for jobs, and has been terminated.
- I use Carthage for my Swift dependencies
This has always worked well and the implementation of a Travis cache for Carthage can speed up the work. Not downloading and build all dependencies for each pull request/delivery is essential.
The timeout can be reached, but we launch again the CI and it works thanks to the cache (which makes the second build faster).
language: swift osx_image: xcode11.2 xcode_workspace: waosSwift.xcworkspace xcode_scheme: waosSwift xcode_destination: platform=iOS Simulator,OS=12.0,name=iPhone X cache: bundler: true directories: - Carthage before_install: - brew install carthage || true - brew outdated carthage || brew upgrade carthage - rvm use $RVM_RUBY_VERSION #slather install: bundle install --without=documentation before_script: - carthage bootstrap --no-build --new-resolver - (cd Carthage/Checkouts/ReactorKit && swift package generate-xcodeproj) - carthage build --platform iOS --no-use-binaries --cache-builds after_success: - fastlane lint - fastlane test
However, for my last PR, it was impossible. I restarted the build two times mechanically but it didn't work. Dependencies and many files have been added to the project in this PR. I then realized that currently, Travis uploads cache to one of these last steps ...
So if the cache is not uploaded before the Travis timeout, the next build starts again from scratch, with no cache ..
We must therefore think about limiting our long commands which generating cache. By doing this, the cache is uploaded before the timeout, and available for the next build.
before_script: - carthage bootstrap --no-build --new-resolver - (cd Carthage/Checkouts/ReactorKit && swift package generate-xcodeproj) - timeout 30m carthage build --platform iOS --no-use-binaries --cache-builds || true