.travis.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. language: php
  2. php:
  3. - '5.6'
  4. - '7.0.21'
  5. - '7.1'
  6. - '7.2'
  7. branches:
  8. only:
  9. - develop
  10. - master
  11. - build_test
  12. notifications:
  13. email:
  14. on_success: never
  15. on_failure: always
  16. hipchat:
  17. # hipchat_api@grav
  18. rooms:
  19. - secure: "bqO0wM1B7bJnQw2fuhquSXEqI9gw6WmFytIh9sEWXzbYTzTUP5t0PcKOd3FT2BNMRaDxPJLVl+vG/oqmqDUBkEmOGcG504IQjeNzZqnMz0tXQMIcCc22Las9tFfc4Jf6RVi/qGomFtHGE9Wgii+TAN4zqZaufbNjwd8SyjO0+W8="
  20. template:
  21. - '%{repository}#%{build_number} (%{branch}): Travis Job Finished [%{duration}] (<a href="%{build_url}">Details</a>)'
  22. format: html
  23. slack:
  24. secure: dowksPsxxCxGKT6nis5hUgkp6+ZDAhoqzQHF9rJnx4hx0iEygPhVBs7pKl9yL2jubYJoLs+EXwE7z1dYgDAEJh4BnfrCokCMLpFGcxVxQC/HeAUdSQ2/RtdBYR5PRT75ScaFpqM/SfXXZVtnwVXAw9Z+JC6BjQ9vmn23m51Jw4k=
  25. env:
  26. global:
  27. # Colors!
  28. - TEXTRESET=$(tput sgr0) # reset the foreground colour
  29. - RED=$(tput setaf 1)
  30. - GREEN=$(tput setaf 2)
  31. - YELLOW=$(tput setaf 3)
  32. - BLUE=$(tput setaf 4)
  33. - BOLD=$(tput bold)
  34. # User
  35. - GH_USER="getgrav"
  36. # Paths
  37. - RT_DEVTOOLS=$HOME/devtools
  38. - GOPATH="$HOME/go"
  39. - PATH="$GOPATH/bin:$PATH"
  40. # GH_TOKEN [API Key]
  41. - secure: "NR9pV7YteY9OoPmjDTQG0fDfocVu+tCeiDH1F2GFhXCu71UOIvqWXpOxp0RHkG5GIXdCFHx59yu+ZO275lbaHkbF8+4lVSVrV4RcGn+pIncvxr6iZCVW05dbAxV3H8alK+xYJRGmbyfQl5wIM49WvmuGHZjcmIloS4t/omQ3N+I="
  42. # BB_TOKEN value => "user:pass@"
  43. - secure: "einUtSEkUWy2IrqLXyVjwUU+mwaaoiOXRRVdLBpA3Zye6bZx8cm5h/5AplkPWhM/NmCJoW/MwNZHHkFhlr3mDRov5iOxVmTTYfnXB+I5lxYTSgduOLLErS7mU8hfADpVDU8bHNU44fNGD3UEiG1PD4qQBX4DMlqIFmR20mjs81k="
  44. # GH_API_USER [for curl]
  45. - secure: "AQGcX1B2NrI8ajflY4AimZDNcK2kBA3F6mbtEFQ78NkDoWhMipsQHayWXiSTzRc0YJKvQl2Y16MTwQF4VHzjTAiiZFATgA8J88vQUjIPabi/kKjqSmcLFoaAOAxStQbW6e0z2GiQ6KBMcNF1y5iUuI63xVrBvtKrYX/w5y+ako8="
  46. before_install:
  47. - export TZ=Pacific/Honolulu
  48. - echo $TRAVIS_PHP_VERSION
  49. - echo $TRAVIS_BRANCH
  50. - echo $TRAVIS_PULL_REQUEST
  51. - composer self-update
  52. - if [ $TRAVIS_BRANCH == 'develop' ] || [ $TRAVIS_PULL_REQUEST != 'false' ]; then
  53. composer install --dev --prefer-dist;
  54. fi
  55. - if [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == "5.6" ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
  56. export TRAVIS_TAG=$(curl --fail --user "${GH_API_USER}" -s https://api.github.com/repos/getgrav/grav/releases/latest | grep tag_name | head -n 1 | cut -d '"' -f 4);
  57. eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.8 bash)";
  58. go get github.com/aktau/github-release;
  59. git clone --quiet --depth=50 --branch=master https://${BB_TOKEN}bitbucket.org/rockettheme/grav-devtools.git $RT_DEVTOOLS &>/dev/null;
  60. if [ ! -z "$TRAVIS_TAG" ]; then
  61. cd ${RT_DEVTOOLS};
  62. ./build-grav.sh skeletons.txt;
  63. fi;
  64. fi
  65. before_script:
  66. - if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then phpenv config-rm xdebug.ini; fi
  67. script:
  68. - if [ $TRAVIS_BRANCH == 'develop' ] || [ $TRAVIS_PULL_REQUEST != 'false' ]; then
  69. vendor/bin/codecept run;
  70. fi
  71. - echo "Latest Release Tag - ${TRAVIS_TAG}"
  72. - if [ ! -z "$TRAVIS_TAG" ] && [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == "5.6" ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
  73. FILES="$RT_DEVTOOLS/grav-dist/*.zip";
  74. for file in ${FILES[@]}; do
  75. NAME=${file##*/};
  76. if [[ "$NAME" == *"-rc"* ]]; then
  77. REPO="$(echo ${NAME} | rev | cut -f 3- -d "-" | rev)";
  78. else
  79. REPO="$(echo ${NAME} | rev | cut -f 2- -d "-" | rev)";
  80. fi;
  81. if [[ $REPO == 'grav' || $REPO == 'grav-admin' || $REPO == 'grav-update' ]]; then
  82. REPO="grav";
  83. fi;
  84. API="$(curl --fail --user "${GH_API_USER}" -s https://api.github.com/repos/${GH_USER}/${REPO}/releases/latest)";
  85. ASSETS="$(echo "${API}" | node gh-assets.js)";
  86. TAG="$(echo "${API}" | grep tag_name | head -n 1 | cut -d '"' -f 4)";
  87. if [ $REPO == "grav" ]; then
  88. TAG="$TRAVIS_TAG";
  89. fi;
  90. if [ ! -z "$ASSETS" ]; then
  91. for asset in ${ASSETS[@]}; do
  92. asset_id=$(echo ${asset} | cut -d ':' -f 1);
  93. asset_name=$(echo ${asset} | cut -d ':' -f 2);
  94. if [ "${NAME}" == "${asset_name}" ]; then
  95. echo -e "\nAsset ${BOLD}${BLUE}${NAME}${TEXTRESET} already exists in ${YELLOW}${REPO}${TEXTRESET}@${BOLD}${YELLOW}${TAG}${TEXTRESET}... deleting id ${BOLD}${RED}${asset_id}${TEXTRESET}...";
  96. curl -X DELETE --fail --user "${GH_API_USER}" "https://api.github.com/repos/${GH_USER}/${REPO}/releases/assets/${asset_id}";
  97. fi;
  98. done;
  99. fi;
  100. echo "Uploading package ${BOLD}${BLUE}${NAME}${TEXTRESET} to ${YELLOW}${REPO}${TEXTRESET}@${YELLOW}${TAG}${TEXTRESET}";
  101. github-release upload --security-token $GH_TOKEN --user ${GH_USER} --repo $REPO --tag "$TAG" --name "$NAME" --file "$file";
  102. done;
  103. fi