language: c

env:
  global:
    - PROJECT_REPO=$(echo "${TRAVIS_REPO_SLUG}" | cut -d '/' -f 1)
    - PROJECT_NAME=$(echo "${TRAVIS_REPO_SLUG}" | cut -d '/' -f 2)
    - PROJECT_VERSION="5.3"
    - INSTALL_DIR="/tmp/${PROJECT_NAME}"
    - DEPLOY_DIR="/tmp/${PROJECT_NAME}-deploy"
    - DEPLOY_ARCHIVE="tar.bz2"
    - BINTRAY_USER="mikrosk"
    # BINTRAY_API_KEY is defined in Travis Settings of freemint/fdlibm
    - BINTRAY_REPO="lib"

# If before_install, install or before_script return a non-zero exit code, the build is errored and stops immediately.
before_install:
  - wget -q -O - https://github.com/freemint/travis-scripts/archive/master.tar.gz | tar xzf - --strip-components=1 -C .travis
  - if [ -x .travis/before_install.sh ]; then ./.travis/before_install.sh; else true; fi

install:
  - if [ -x .travis/install.sh ]; then ./.travis/install.sh; else true; fi

before_script:
  - if [ -x .travis/before_script.sh ]; then ./.travis/before_script.sh; else true; fi

# If script returns a non-zero exit code, the build is failed, but continues to run before being marked as failed.
script:
  - if [ -x .travis/script.sh ]; then ./.travis/script.sh; else true; fi
# The exit code of after_success, after_failure, after_script and subsequent stages do not affect the build result.
# However, if one of these stages times out, the build is marked as a failure.
after_success:
  - if [ -x .travis/after_success.sh ]; then ./.travis/after_success.sh; else true; fi
after_failure:
  - if [ -x .travis/after_failure.sh ]; then ./.travis/after_failure.sh; else true; fi

# A non-zero exit code in this phase will mark the build as errored.
before_deploy:
  - if [ -x .travis/before_deploy.sh ]; then ./.travis/before_deploy.sh; else true; fi

deploy:
  provider: bintray
  file: ".travis/bintray.desc"
  user: "${BINTRAY_USER}"
  key: "${BINTRAY_API_KEY}"
  skip_cleanup: true
  on:
    branch: master
    repo: freemint/fdlibm

after_deploy:
  - if [ -x .travis/after_deploy.sh ]; then ./.travis/after_deploy.sh; else true; fi

after_script:
  - if [ -x .travis/after_script.sh ]; then ./.travis/after_script.sh; else true; fi
