Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Travis CI tips

Olivier Paroz edited this page Sep 18, 2015 · 1 revision

Change core branch

  - cd ${TRAVIS_BUILD_DIR}/../core/
  - git fetch origin local_branch_name:remote_branch_name
  - git checkout local_branch_name

Note: The remote branch name is the one used in the PR you want to test

Use caching

Useful if you have lots of Composer packages to load for testing

cache:
  directories:
    - ${TRAVIS_BUILD_DIR}/travis/php-cache
    - $HOME/.composer/cache

before_cache:
  # Archive the vendor folder
  - cp -r ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`

before_install:
  # Sets up the cache
  - sh -c "if [ ! -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum` ]; then mkdir -p ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`; fi;"
  - rm -rf ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME/vendor
  - sh -c "if [ -d ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ]; then cp -r ${TRAVIS_BUILD_DIR}/travis/php-cache/`php-config --vernum`/vendor ${TRAVIS_BUILD_DIR}/../core/apps/$APP_NAME; fi;"