]> source.dussan.org Git - sonarqube.git/commitdiff
Use Trusty image on TravisCI
authorTom <thomas.verin@sonarsource.com>
Fri, 5 May 2017 12:31:54 +0000 (14:31 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 26 May 2017 09:56:39 +0000 (11:56 +0200)
- environment is more stable through time (no variations of build
  durations)

- benefit from 8Gb ramdisk

- enable parallel Maven build thanks to new CPUs

.travis.yml
.travis/setup_ramdisk.sh [new file with mode: 0755]
clock.sh [deleted file]
scripts/setupRamdisk.sh [new file with mode: 0755]
travis.sh

index 35d74c724cd9097bb1e9df5456f15a7d5decfd9e..35df96cfde4b98e1e1dfd3ae53dcb1a51d57eb43 100644 (file)
@@ -1,8 +1,9 @@
-language: java
-sudo: false
+language: generic
+sudo: required
 install: true
 jdk: oraclejdk8
 script: ./travis.sh
+dist: trusty
 
 env:
   - TARGET=BUILD
diff --git a/.travis/setup_ramdisk.sh b/.travis/setup_ramdisk.sh
new file mode 100755 (executable)
index 0000000..1ac8f5b
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -euo pipefail
+
+RED='\033[0;31m'
+NC='\033[0m' # No Color
+printf "${RED}SETUP RAMDISK${NC}\n"
+printf "${RED}disk size before build${NC}\n"
+df -h
+du -sh $HOME
+
+printf "${RED}move original home${NC}\n"
+sudo mv /home/travis /home/travis.ori
+printf "${RED}create ramdisk mount point${NC}\n"
+sudo mkdir -p /home/travis
+printf "${RED}create ramdisk${NC}\n"
+sudo mount -t tmpfs -o size=8192m tmps /home/travis
+printf "${RED}copy home to ramdisk${NC}\n"
+time sudo cp -R /home/travis.ori/. /home/travis
+printf "${RED}give permissions to travis on its home in ramdisk${NC}\n"
+sudo chown -R travis:travis /home/travis
+
diff --git a/clock.sh b/clock.sh
deleted file mode 100755 (executable)
index 91c2c58..0000000
--- a/clock.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-RED='\033[0;31m'
-NC='\033[0m' # No Color
-
-echo "start the clock"
-while [ ! -f stop ]; do
-  #echo "File not found!"
-  seconds=60; date1=$((`date +%s` + $seconds)); 
-  while [ "$date1" -ge `date +%s` ]; do 
-    #echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r"; > /dev/null
-    : #busy wait
-  done
-  printf "${RED}############# `date` ############${NC}\n"
-done
\ No newline at end of file
diff --git a/scripts/setupRamdisk.sh b/scripts/setupRamdisk.sh
new file mode 100755 (executable)
index 0000000..1ac8f5b
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -euo pipefail
+
+RED='\033[0;31m'
+NC='\033[0m' # No Color
+printf "${RED}SETUP RAMDISK${NC}\n"
+printf "${RED}disk size before build${NC}\n"
+df -h
+du -sh $HOME
+
+printf "${RED}move original home${NC}\n"
+sudo mv /home/travis /home/travis.ori
+printf "${RED}create ramdisk mount point${NC}\n"
+sudo mkdir -p /home/travis
+printf "${RED}create ramdisk${NC}\n"
+sudo mount -t tmpfs -o size=8192m tmps /home/travis
+printf "${RED}copy home to ramdisk${NC}\n"
+time sudo cp -R /home/travis.ori/. /home/travis
+printf "${RED}give permissions to travis on its home in ramdisk${NC}\n"
+sudo chown -R travis:travis /home/travis
+
index e76c29285edcf1febb56543e7faf4c6a309e2f85..b317f298813f176c79290145cd4613156dfb1488 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -1,6 +1,8 @@
 #!/bin/bash
 set -euo pipefail
 
+./.travis/setup_ramdisk.sh
+
 function installPhantomJs {
   echo "Setup PhantomJS 2.1"
   mkdir -p ~/phantomjs
@@ -111,7 +113,7 @@ function fixBuildVersion {
 # Configure Maven settings and install some script utilities
 #
 function configureTravis {
-  mkdir ~/.local
+  mkdir -p ~/.local
   curl -sSL https://github.com/SonarSource/travis-utils/tarball/v36 | tar zx --strip-components 1 -C ~/.local
   source ~/.local/bin/install
 }
@@ -126,17 +128,13 @@ case "$TARGET" in
 
 BUILD)
 
-  # Hack to keep job alive even if no logs during more than 10 minutes.
-  # That can occur when uploading sonarqube.zip to Artifactory.
-  ./clock.sh &
-
   installJdk8
   installMaven
   fixBuildVersion
 
   # Minimal Maven settings
   export MAVEN_OPTS="-Xmx1G -Xms128m"
-  MAVEN_ARGS="-Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION"
+  MAVEN_ARGS="-T 1C -Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION"
 
   if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
     echo 'Build and analyze master'
@@ -148,13 +146,15 @@ BUILD)
     # For this reason errors are ignored with "|| true"
     git fetch --unshallow || true
 
-    mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
+    mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \
           $MAVEN_ARGS \
-          -Pdeploy-sonarsource,release \
+          -Pdeploy-sonarsource,release
+    mvn sonar:sonar \
           -Dsonar.host.url=$SONAR_HOST_URL \
           -Dsonar.login=$SONAR_TOKEN \
           -Dsonar.projectVersion=$INITIAL_VERSION
 
+
   elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
     echo 'Build release branch'
 
@@ -163,10 +163,11 @@ BUILD)
   elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
     echo 'Build and analyze internal pull request'
 
-    mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
+    mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \
         $MAVEN_ARGS \
         -Dsource.skip=true \
-        -Pdeploy-sonarsource \
+        -Pdeploy-sonarsource
+    mvn sonar:sonar \
         -Dsonar.analysis.mode=preview \
         -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
         -Dsonar.github.repository=$TRAVIS_REPO_SLUG \
@@ -198,6 +199,3 @@ WEB_TESTS)
   ;;
 
 esac
-
-#stop the clock
-touch stop