Skip to content

Commit

Permalink
added changes for travis CI and coveralls.
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasMisaghMoayyed committed Jul 18, 2014
1 parent 13c65fb commit 6e51f25
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 19 deletions.
26 changes: 16 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
/grouper-parent/target/
/grouper-misc/morphString/target/
/grouper-misc/grouperClient/target/
/subject/target/
/grouper/target/
/ldappcng/grouper-shib/target/
/grouper/bin/*
**/target
**/classes
**/.idea
**/*.iml
/**/bin/*
/grouper/logs/
/ldappcng/ldappcng/target/
/grouper/build.properties
/grouper/build.log
/grouper-misc/grouperScim/target/
/grouper-ui/webapp/WEB-INF/classes
grouper/conf/ehcache.xml
grouper/conf/grouper.client.properties
grouper/conf/grouper.hibernate.properties
grouper/conf/grouper.properties
grouper/conf/grouper-loader.properties
grouper/conf/log4j.properties
grouper/conf/morphString.properties
grouper/conf/server.properties
grouper/conf/sources.xml
grouper/conf/spy.properties
grouper/conf/subject.properties
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Steps to enable the this build are:
#
# Generate the OAUTH-TOKEN atd at https://github.com/settings/applications
# Install travis: gem install travis
# Login to travis: travis login
# Encrypt the token: travis encrypt GH_TOKEN=[OAUTH-TOKEN] -r Jasig/cas --add env.global
#

language: java
branches:
only:
- master
- GROUPER_2_1_BRANCH
- GROUPER_2_2_BRANCH
jdk:
- oraclejdk7
- openjdk6
- openjdk7
- oraclejdk8
before_script:
- cd grouper-parent
script:
- mvn clean package
before_install:
#- chmod -R 777 ./travis/init-travis-build.sh
#- ./travis/init-travis-build.sh
after_success:
#- chmod -R 777 ./travis/push-javadoc-to-gh-pages.sh
#- ./travis/push-javadoc-to-gh-pages.sh
- mvn clean test cobertura:cobertura coveralls:cobertura
#- chmod -R 777 ./travis/test-commit-message.sh
#- ./travis/test-commit-message.sh
59 changes: 50 additions & 9 deletions grouper-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,21 @@
</modules>

<properties>
<!-- Build Settings -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>

<!-- Plugin Versions -->
<maven-javadoc-plugin.version>2.9.1</maven-javadoc-plugin.version>
<maven-jar-plugin.version>2.5</maven-jar-plugin.version>
<maven-source-plugin.version>2.1.2</maven-source-plugin.version>
<maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
<maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<cobertura-maven-plugin.version>2.6</cobertura-maven-plugin.version>
<coveralls-maven-plugin.version>2.2.0</coveralls-maven-plugin.version>

</properties>

<repositories>
Expand All @@ -40,6 +52,10 @@
<id>shib-release</id>
<url>https://shibboleth.net/nexus/content/groups/public</url>
</repository>
<repository>
<id>nexus-releases</id>
<url>http://oss.sonatype.org/content/repositories/releases/</url>
</repository>
</repositories>

<!-- Dependencies required by every project module. -->
Expand Down Expand Up @@ -455,14 +471,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>source</id>
Expand All @@ -476,7 +493,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<version>${maven-jar-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -490,11 +507,35 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>${coveralls-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura-maven-plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<format>xml</format>
<maxmem>256m</maxmem>
<!-- aggregated reports for multi-module projects -->
<aggregate>true</aggregate>

<excludes>
<!-- Exclude generated classes -->
<exclude>**/*_.class</exclude>
<exclude>**/*_.java</exclude>
</excludes>

</configuration>
</plugin>
<!-- for grouper project -->
Expand Down Expand Up @@ -535,7 +576,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -548,7 +589,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>release-javadoc</id>
Expand All @@ -568,7 +609,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.1</version>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -589,7 +630,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
Expand Down
18 changes: 18 additions & 0 deletions travis/init-travis-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

echo -e "Building branch: ${TRAVIS_BRANCH}"
echo -e "Build directory: ${TRAVIS_BUILD_DIR}"
echo -e "Build id: ${TRAVIS_BUILD_ID}"
echo -e "Builder number: ${TRAVIS_BUILD_NUMBER}"
echo -e "Job id: ${TRAVIS_JOB_ID}"
echo -e "Job number: ${TRAVIS_JOB_NUMBER}"
echo -e "Repo slug: ${TRAVIS_REPO_SLUG}"
echo -e "OS name: ${TRAVIS_OS_NAME}"

if [ "$TRAVIS_SECURE_ENV_VARS" == "false" ]
then
echo -e "Secure environment variables are NOT available...\n"
else
echo -e "Secure environment variables are available...\n"
#echo -e "GH_TOKEN -> ${GH_TOKEN}"
fi
67 changes: 67 additions & 0 deletions travis/push-javadoc-to-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
#
# Licensed to Jasig under one or more contributor license
# agreements. See the NOTICE file distributed with this work
# for additional information regarding copyright ownership.
# Jasig licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a
# copy of the License at the following location:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

invokeJavadoc=false

# Only invoke the javadoc deployment process
# for the first job in the build matrix, so as
# to avoid multiple deployments.

if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
case "${TRAVIS_JOB_NUMBER}" in
*\.1)
echo -e "Invoking Javadoc deployment for Travis job ${TRAVIS_JOB_NUMBER}"
invokeJavadoc=true;;
esac
fi

if [ "$invokeJavadoc" == true ]; then

echo -e "Start to publish lastest Javadoc to gh-pages...\n"

echo -e "Invokin Maven to generate the site documentation...\n"
mvn site site:stage -q -ff -B

echo -e "Copying the generated docs over...\n"
cp -R target/staging $HOME/javadoc-latest

cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "travis-ci"
echo -e "Cloning the gh-pages branch...\n"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/Jasig/cas gh-pages > /dev/null

cd gh-pages
echo -e "Removing javadocs...\n"
git rm -rf ./current/javadocs
git rm -rf ./development/javadocs

echo -e "Copying new javadocs to current...\n"
cp -Rf $HOME/javadoc-latest ./development/javadocs
echo -e "Adding changes to the index...\n"
git add -f .
echo -e "Committing changes...\n"
git commit -m "Lastest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
echo -e "Pushing upstream to origin...\n"
git push -fq origin gh-pages > /dev/null

echo -e "Done magic with auto publishment to gh-pages.\n"

fi
41 changes: 41 additions & 0 deletions travis/test-commit-message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

if test "$1" == ""; then
if [ "$TRAVIS_COMMIT_RANGE" == "" -o "$TRAVIS_PULL_REQUEST" == "false" ]
then
echo -n "Using fallback for commit range (last commit): "
RANGE='HEAD^..HEAD'
else
echo -n "Using \$TRAVIS_COMMIT_RANGE for commit range: "
# Range is given on the form of 515744f1079f...23be2b8db4d7.
# Therefore, we need to adjust it to Git commit range format.
RANGE=`echo $TRAVIS_COMMIT_RANGE | sed 's/\.\.\./../'`
fi
else
echo -n "Using command line parameter for commit range: "
RANGE=$1
fi
echo $RANGE

for sha in `git log --format=oneline "$RANGE" | cut '-d ' -f1`
do
echo -e "Checking commit message for SHA: $sha..."
git rev-list --no-merges --format=%B --max-count=1 $sha|awk '
NR == 2 && !/^(CAS-|CHECKSTYLE|JAVADOCS|NOJIRA|\[maven-release-plugin\])/ {
print "Commit message does not comply with commit guidelines."
print "Message:"
print $0
exit 1
}
'
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo -e "\nTravis-CI build has failed."
echo
echo "Commit message for $sha is not following commit guidelines. Please see:"
echo "http://jasig.github.io/cas/developer/Contributor-Guidelines.html"
exit $EXITCODE
else
echo "OK."
fi
done

0 comments on commit 6e51f25

Please sign in to comment.