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.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. installTravisTools
  27. /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
  28. wget http://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar
  29. nohup java -jar selenium-server-standalone-2.46.0.jar &
  30. sleep 3
  31. cd server/sonar-web && npm install && npm test
  32. ;;
  33. PRANALYSIS)
  34. if [ -n "$SONAR_GITHUB_OAUTH" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  35. echo "Start pullrequest analysis"
  36. mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -B -e -V -Dmaven.test.failure.ignore=true -Dclirr=true \
  37. -Dsonar.analysis.mode=incremental \
  38. -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
  39. -Dsonar.github.repository=$SONAR_GITHUB_REPOSITORY \
  40. -Dsonar.github.login=$SONAR_GITHUB_LOGIN \
  41. -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
  42. -Dsonar.host.url=$SONAR_HOST_URL \
  43. -Dsonar.login=$SONAR_LOGIN \
  44. -Dsonar.password=$SONAR_PASSWD
  45. fi
  46. ;;
  47. ITS)
  48. if [ "$IT_CATEGORY" == "plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  49. echo "Ignore this job since it needs access to private test licenses."
  50. else
  51. installTravisTools
  52. start_xvfb
  53. CATEGORIES=($(echo "$IT_CATEGORY" | tr '_' '\n'))
  54. CATEGORY1=${CATEGORIES[0]:-'NONE'}
  55. CATEGORY2=${CATEGORIES[1]:-'NONE'}
  56. mvn install -Pit,dev -DskipTests -Dcategory1="$CATEGORY1" -Dcategory2="$CATEGORY2" -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
  57. fi
  58. ;;
  59. esac