Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Carthage cache on Travis CI

I am using Travis CI for iOS project. My .travis.yml file is as below.

language: objective-c
osx_image: xcode9.2

cache:
  directories:
  - Carthage

env:
  #environment variables
  global:
    - LANG=en_US.UTF-8
    - LC_ALL=en_US.UTF-8
    - PROJECT_NAME="MyProject.xcodeproj"
    - SCHEME_IOS_FRAMEWORK="Framework_iOS"
    - SCHEME_TVOS_FRAMEWORK="Framework_tvOS"
    - IOS_SDK=iphonesimulator11.2
    - TVOS_SDK=appletvsimulator11.2
  matrix:
    - DESTINATION="OS=11.2,name=iPhone X" SCHEME="$SCHEME_IOS_FRAMEWORK" SDK="$IOS_SDK"
    - DESTINATION="OS=11.0,name=Apple TV 1080p" SCHEME="$SCHEME_TVOS_FRAMEWORK" SDK="$TVOS_SDK"

before_install:
  - brew install carthage || true
  - brew outdated carthage || brew upgrade carthage
  - gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet

before_script:
  # bootstrap the dependencies for the project
  - carthage bootstrap --platform iOS --no-use-binaries --cache-builds
  - carthage bootstrap --platform tvOS --no-use-binaries --cache-builds

script:
  - set -o pipefail
  - xcodebuild clean test -project "$PROJECT_NAME" -scheme "$SCHEME" -destination "$DESTINATION" -sdk "$SDK" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO | xcpretty -f `xcpretty-travis-formatter`

I have 2 schemes, one for iOS and other tvOS. The build passes in Travis but it takes 18-20 minutes The below is from Trvais log enter image description here

Any workaround to optimize the build time in Travis? I just started learning continuous integration. Are there any mistakes in YML script for Travis?

like image 694
Abin Baby Avatar asked Feb 13 '18 15:02

Abin Baby


1 Answers

Just use carthage update --cache-builds beside your current caching configuration. It works for me after running the second time.

like image 53
Chau Duong Khong Avatar answered Nov 13 '22 01:11

Chau Duong Khong