Przeglądaj źródła

Use Trusty image on TravisCI

- environment is more stable through time (no variations of build
  durations)

- benefit from 8Gb ramdisk

- enable parallel Maven build thanks to new CPUs
tags/6.4-RC3
Tom 7 lat temu
rodzic
commit
ce9ac5a32c
5 zmienionych plików z 56 dodań i 29 usunięć
  1. 3
    2
      .travis.yml
  2. 21
    0
      .travis/setup_ramdisk.sh
  3. 0
    14
      clock.sh
  4. 21
    0
      scripts/setupRamdisk.sh
  5. 11
    13
      travis.sh

+ 3
- 2
.travis.yml Wyświetl plik

language: java
sudo: false
language: generic
sudo: required
install: true install: true
jdk: oraclejdk8 jdk: oraclejdk8
script: ./travis.sh script: ./travis.sh
dist: trusty


env: env:
- TARGET=BUILD - TARGET=BUILD

+ 21
- 0
.travis/setup_ramdisk.sh Wyświetl plik

#!/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


+ 0
- 14
clock.sh Wyświetl plik

#!/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

+ 21
- 0
scripts/setupRamdisk.sh Wyświetl plik

#!/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


+ 11
- 13
travis.sh Wyświetl plik

#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail


./.travis/setup_ramdisk.sh

function installPhantomJs { function installPhantomJs {
echo "Setup PhantomJS 2.1" echo "Setup PhantomJS 2.1"
mkdir -p ~/phantomjs mkdir -p ~/phantomjs
# Configure Maven settings and install some script utilities # Configure Maven settings and install some script utilities
# #
function configureTravis { function configureTravis {
mkdir ~/.local
mkdir -p ~/.local
curl -sSL https://github.com/SonarSource/travis-utils/tarball/v36 | tar zx --strip-components 1 -C ~/.local curl -sSL https://github.com/SonarSource/travis-utils/tarball/v36 | tar zx --strip-components 1 -C ~/.local
source ~/.local/bin/install source ~/.local/bin/install
} }


BUILD) 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 installJdk8
installMaven installMaven
fixBuildVersion fixBuildVersion


# Minimal Maven settings # Minimal Maven settings
export MAVEN_OPTS="-Xmx1G -Xms128m" 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 if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo 'Build and analyze master' echo 'Build and analyze master'
# For this reason errors are ignored with "|| true" # For this reason errors are ignored with "|| true"
git fetch --unshallow || 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 \ $MAVEN_ARGS \
-Pdeploy-sonarsource,release \
-Pdeploy-sonarsource,release
mvn sonar:sonar \
-Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_TOKEN \ -Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=$INITIAL_VERSION -Dsonar.projectVersion=$INITIAL_VERSION



elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo 'Build release branch' echo 'Build release branch'


elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
echo 'Build and analyze internal pull request' 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 \ $MAVEN_ARGS \
-Dsource.skip=true \ -Dsource.skip=true \
-Pdeploy-sonarsource \
-Pdeploy-sonarsource
mvn sonar:sonar \
-Dsonar.analysis.mode=preview \ -Dsonar.analysis.mode=preview \
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \ -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \ -Dsonar.github.repository=$TRAVIS_REPO_SLUG \
;; ;;


esac esac

#stop the clock
touch stop

Ładowanie…
Anuluj
Zapisz