thegreyd
thegreyd

Reputation: 86

Path to repository in travis

I am not able to locate the path to my repo (that is cloned) in travis. When I perform ls, there is no output. I have tried ls ~/username/repo and ls ~/repo but get no such file or directory

Some background: I am integrating my android app with travis-ci. I want to create a new .java file, before build in travis. Since this file is private and added to .gitignore and is on build machines only. I intend to add content to this file by using encrypted environment variable feature.

Any custom command doesn't show the output. Not even echo. There is an environment variable $TRAVIS_BUILD_DIR but not sure how to use it

Upvotes: 2

Views: 1361

Answers (1)

albodelu
albodelu

Reputation: 7971

I guess it's a syntax issue, be sure you use it like here, it normally works:

TRAVIS_BUILD_DIR: The absolute path to the directory where the repository being built has been copied on the worker.

- ${TRAVIS_BUILD_DIR}/gradle/caches/

- ls ${TRAVIS_BUILD_DIR}/gradle/caches/

Also check the lines below from here that links to this build and travis.yml (it works as shown here):

env:
  global:
    - ANDROID_HOME=${TRAVIS_BUILD_DIR}/android-sdk
    - PATH=${ANDROID_HOME}/:${ANDROID_HOME}/tools/:${ANDROID_HOME}/platform-tools/:${PATH}

before_install:
  - cp -R /usr/local/android-sdk-23.0.2 ./android-sdk

... You could create a ${TRAVIS_BUILD_DIR}/.travis-ci folder and save there all the stuff so we can custom it.

  # Comment out the lines below to show system image properties
  - 'echo ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI}'
  - 'ls ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI} -al || true'
  - 'cat ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI}/build.prop || true'

  - echo 'DEFAULT SCRIPTS'
  # Comment out the lines below to check default android scripts and PATH
  - echo "$PATH"
  - ls /usr/local/bin -Al
  - cat /usr/local/bin/android-accept-licenses
  - cat /usr/local/bin/android-update-sdk
  - cat /usr/local/bin/android-wait-for-emulator

Upvotes: 4

Related Questions