8000 Caching: use of CACHE_NAME - differencation based on env name? · Issue #887 · travis-ci/docs-travis-ci-com · GitHub
[go: up one dir, main page]

Skip to content
Caching: use of CACHE_NAME - differencation based on env name? #887
@grooverdan

Description

@grooverdan

I'm compiling with multiple gcc version like:

compiler:
  - gcc
  - clang
env:
  - GCC_VERSION=5
  - GCC_VERSION=6
script:
  - if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then
      export MYSQL_BUILD_CC=/usr/bin/clang-3.8  MYSQL_BUILD_CXX=/usr/bin/clang++-3.8;
    fi
  - if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'g++' ]]; then
      export MYSQL_BUILD_CC=/usr/bin/gcc-${GCC_VERSION} MYSQL_BUILD_CXX=/usr/bin/g++-${GCC_VERSION};
    fi
  - ....

I'm trying to work out how to set CACHE_NAME so each GCC version gets a unique name. This is to solve the problem that the builds are concurrent and will override each others ccache rather than aggregating them or separating them.

As the cache is retrieved before the before_install phase (https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle) it can't be scripted.

The following did appear to work.

env:
  - GCC_VERSION=5 CACHE_NAME=${TRAVIS_OS_NAME}-${CC}-${GCC_VERSION}
  - GCC_VERSION=6
Setting environment variables from .travis.yml
$ export GCC_VERSION=5
$ export CACHE_NAME=${TRAVIS_OS_NAME}-${CC}-${GCC_VERSION}
$ export CXX=clang++
$ export CC=clang
$ export PATH=/usr/lib/ccache:$PATH
cache.1
Setting up build cache
$ export CASHER_DIR=$HOME/.casher
$ Installing caching utilities
attempting to download cache archive
fetching 10.2-travis-clang/cache-linux-trusty-a16944a9cbbaae897e8d1989ff7a3a8a7e71250b5c80f0949f1755d4f7bdf8ab--compiler-clang.tgz
found cache

Is this how CACHE_NAME meant to be used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0