70

When working with the .travis.yml, is there an environment variable that contains the name of the current build directory in Travis-CI? Looking through the docs here I don't see one.

emmby
  • 99,783
  • 65
  • 191
  • 249

1 Answers1

101

You probably want $TRAVIS_BUILD_DIR, which is the directory we clone the repository to and cd into afterwards, before running your tests.

sarahhodne
  • 9,796
  • 3
  • 39
  • 44
  • 7
    Documented at: http://docs.travis-ci.com/user/ci-environment/#Environment-variables – Ciro Santilli OurBigBook.com Sep 16 '14 at 12:01
  • 2
    Has this changed? It seems to be that `$TRAVIS_BUILD_DIR` _is_ the repo dir, i.e. has a `.git` directory. – OJFord Aug 01 '16 at 14:01
  • 2
    Yes, sorry, my answer may not have been totally clear on that: `$TRAVIS_BUILD_DIR` is the directory that contains your checked-out code (i.e. `$TRAVIS_BUILD_DIR/.git` exists), and is the working directory when your commands start to run. – sarahhodne Dec 01 '16 at 13:39
  • 7
    Now documented at https://docs.travis-ci.com/user/environment-variables/ – oalders Jun 08 '17 at 16:26