Workspaces do not work nicely with cross-platform builds

Continuing the discussion from Introducing Workspaces:

For workspaces and caches, we should accept relative directories to make life easier.

To test it, add:

cache:
  branch: paths-relative

Note that use of environment variables (e.g., $TRAVIS_BUILD_DIR) in directories specifications will not work across OSes because those values will be different on different OSes.

Many caching shortcuts implicitly use $HOME, ~, and other variables. This includes

  • ccache for C and C++ (~/.ccache)
  • elm for Elm ($HOME/.elm)
  • npm for Node.js when Yarn is in use ($HOME/.npm)
  • cocoapods for Objective-C/Swift when the podfile option is in use (this is probably not much of an issue, because it is only runs on the Mac)
  • pip for Python ($TRAVIS_HOME/.cache/pip)
  • packages for R ($R_LIBS_USER)
  • cargo for Rust ($TRAVIS_HOME/.cargo and others)

It seems to me accommodating these would be some work, and that, in general, we expect these files to be platform-dependent. Consequently, advise users that the cross-platform files should be cached using relative paths instead of these shortcuts.

Imprint