You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

travis.sh 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. set -euo pipefail
  3. function installTravisTools {
  4. mkdir ~/.local
  5. curl -sSL https://github.com/SonarSource/travis-utils/tarball/v19 | tar zx --strip-components 1 -C ~/.local
  6. source ~/.local/bin/install
  7. }
  8. case "$JOB" in
  9. H2)
  10. mvn verify -B -e -V
  11. ;;
  12. POSTGRES)
  13. installTravisTools
  14. psql -c 'create database sonar;' -U postgres
  15. runDatabaseCI "postgresql" "jdbc:postgresql://localhost/sonar" "postgres" ""
  16. ;;
  17. MYSQL)
  18. installTravisTools
  19. mysql -e "CREATE DATABASE sonar CHARACTER SET UTF8;" -uroot
  20. mysql -e "CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar';" -uroot
  21. mysql -e "GRANT ALL ON sonar.* TO 'sonar'@'localhost';" -uroot
  22. mysql -e "FLUSH PRIVILEGES;" -uroot
  23. runDatabaseCI "mysql" "jdbc:mysql://localhost/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "sonar" "sonar"
  24. ;;
  25. WEB)
  26. set +eu
  27. source ~/.nvm/nvm.sh && nvm install 4
  28. cd server/sonar-web && npm install && npm test
  29. ;;
  30. PRANALYSIS)
  31. if [ -n "$SONAR_GITHUB_OAUTH" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  32. echo "Start pullrequest analysis"
  33. mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -B -e -V -Dmaven.test.failure.ignore=true -Dclirr=true \
  34. -Dsonar.analysis.mode=incremental \
  35. -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
  36. -Dsonar.github.repository=$SONAR_GITHUB_REPOSITORY \
  37. -Dsonar.github.login=$SONAR_GITHUB_LOGIN \
  38. -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
  39. -Dsonar.host.url=$SONAR_HOST_URL \
  40. -Dsonar.login=$SONAR_LOGIN \
  41. -Dsonar.password=$SONAR_PASSWD
  42. fi
  43. ;;
  44. ITS)
  45. if [ "$IT_CATEGORY" == "plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  46. echo "Ignore this job since it needs access to private test licenses."
  47. else
  48. installTravisTools
  49. start_xvfb
  50. CATEGORIES=($(echo "$IT_CATEGORY" | tr '_' '\n'))
  51. CATEGORY1=${CATEGORIES[0]:-'NONE'}
  52. CATEGORY2=${CATEGORIES[1]:-'NONE'}
  53. mvn install -Pit,dev -DskipTests -Dcategory1="$CATEGORY1" -Dcategory2="$CATEGORY2" -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
  54. fi
  55. ;;
  56. esac