Skip to content

Commit 0c3e935

Browse files
committed
Merge pull request googleapis#568 from ajkannan/run-coveralls-in-branches
Run coveralls for PRs in branches
2 parents c027e47 + 555cc71 commit 0c3e935

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

utilities/after_success.sh

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,38 @@ echo "Travis branch: " ${TRAVIS_BRANCH}
88
echo "Travis pull request: " ${TRAVIS_PULL_REQUEST}
99
echo "Travis JDK version: " ${TRAVIS_JDK_VERSION}
1010

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

35-
cd ..
36-
utilities/update_docs_version.sh # Update version in READMEs
37-
mvn clean deploy --settings ~/.m2/settings.xml -P sign-deploy
38-
else
39-
mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml
40-
fi
35+
cd ..
36+
utilities/update_docs_version.sh # Update version in READMEs
37+
mvn clean deploy --settings ~/.m2/settings.xml -P sign-deploy
38+
else
39+
mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml
40+
fi
41+
else
42+
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
4143
fi
4244
else
4345
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."

0 commit comments

Comments
 (0)