Skip to content

Commit

Permalink
Merge pull request #568 from ajkannan/run-coveralls-in-branches
Browse files Browse the repository at this point in the history
Run coveralls for PRs in branches
  • Loading branch information
aozarov committed Jan 21, 2016
2 parents c027e47 + 555cc71 commit 0c3e935
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,38 @@ echo "Travis branch: " ${TRAVIS_BRANCH}
echo "Travis pull request: " ${TRAVIS_PULL_REQUEST}
echo "Travis JDK version: " ${TRAVIS_JDK_VERSION}

if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" ]; then
if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" ]; then
mvn clean cobertura:cobertura coveralls:report
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
SITE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
# Deploy site if not a SNAPSHOT
git config --global user.name "travis-ci"
git config --global user.email "[email protected]"
git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/gcloud-java/ tmp_gh-pages
mkdir -p tmp_gh-pages/$SITE_VERSION
mvn site -DskipTests=true
mvn site:stage -DtopSiteURL=http://googlecloudplatform.github.io/gcloud-java/site/${SITE_VERSION}/
cd tmp_gh-pages
cp -r ../target/staging/$SITE_VERSION/* $SITE_VERSION/
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/gcloud-java/${SITE_VERSION}/index.html'\" /></head><body></body></html>" > index.html
git add index.html
echo "<html><head><script>window.location.replace('/gcloud-java/${SITE_VERSION}/apidocs' + location.search)</script></head><body></body></html>" > apidocs/index.html
git add apidocs/index.html
git commit -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect."
git config --global push.default simple
git push --quiet "https://${CI_DEPLOY_USERNAME}:${CI_DEPLOY_PASSWORD}@github.com/GoogleCloudPlatform/gcloud-java.git" > /dev/null 2>&1
if [ "${TRAVIS_PULL_REQUEST}" == "false" -a "${TRAVIS_BRANCH}" == "master" ]; then
SITE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
# Deploy site if not a SNAPSHOT
git config --global user.name "travis-ci"
git config --global user.email "[email protected]"
git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/gcloud-java/ tmp_gh-pages
mkdir -p tmp_gh-pages/$SITE_VERSION
mvn site -DskipTests=true
mvn site:stage -DtopSiteURL=http://googlecloudplatform.github.io/gcloud-java/site/${SITE_VERSION}/
cd tmp_gh-pages
cp -r ../target/staging/$SITE_VERSION/* $SITE_VERSION/
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/gcloud-java/${SITE_VERSION}/index.html'\" /></head><body></body></html>" > index.html
git add index.html
echo "<html><head><script>window.location.replace('/gcloud-java/${SITE_VERSION}/apidocs' + location.search)</script></head><body></body></html>" > apidocs/index.html
git add apidocs/index.html
git commit -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect."
git config --global push.default simple
git push --quiet "https://${CI_DEPLOY_USERNAME}:${CI_DEPLOY_PASSWORD}@github.com/GoogleCloudPlatform/gcloud-java.git" > /dev/null 2>&1

cd ..
utilities/update_docs_version.sh # Update version in READMEs
mvn clean deploy --settings ~/.m2/settings.xml -P sign-deploy
else
mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml
fi
cd ..
utilities/update_docs_version.sh # Update version in READMEs
mvn clean deploy --settings ~/.m2/settings.xml -P sign-deploy
else
mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml
fi
else
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
fi
else
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
Expand Down

0 comments on commit 0c3e935

Please sign in to comment.