From 6e51f25fc5be7ee0efc3479e6cd87ebc96d5c125 Mon Sep 17 00:00:00 2001 From: Misagh Moayyed Date: Fri, 18 Jul 2014 11:48:26 -0700 Subject: [PATCH] added changes for travis CI and coveralls. --- .gitignore | 26 +++++++----- .travis.yml | 32 ++++++++++++++ grouper-parent/pom.xml | 59 ++++++++++++++++++++++---- travis/init-travis-build.sh | 18 ++++++++ travis/push-javadoc-to-gh-pages.sh | 67 ++++++++++++++++++++++++++++++ travis/test-commit-message.sh | 41 ++++++++++++++++++ 6 files changed, 224 insertions(+), 19 deletions(-) create mode 100644 .travis.yml create mode 100644 travis/init-travis-build.sh create mode 100644 travis/push-javadoc-to-gh-pages.sh create mode 100644 travis/test-commit-message.sh diff --git a/.gitignore b/.gitignore index 12c8c0583415..59245de159fb 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..a8a63c59a1eb --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/grouper-parent/pom.xml b/grouper-parent/pom.xml index 6d9acc25afe2..e110e535bc9f 100644 --- a/grouper-parent/pom.xml +++ b/grouper-parent/pom.xml @@ -21,9 +21,21 @@ + UTF-8 1.6 1.6 + + + 2.9.1 + 2.5 + 2.1.2 + 1.5 + 2.4 + 3.1 + 2.6 + 2.2.0 + @@ -40,6 +52,10 @@ shib-release https://shibboleth.net/nexus/content/groups/public + + nexus-releases + http://oss.sonatype.org/content/repositories/releases/ + @@ -455,6 +471,7 @@ org.apache.maven.plugins maven-assembly-plugin + ${maven-assembly-plugin.version} gnu @@ -462,7 +479,7 @@ org.apache.maven.plugins maven-source-plugin - 2.1.2 + ${maven-source-plugin.version} source @@ -476,7 +493,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.3.1 + ${maven-jar-plugin.version} @@ -490,11 +507,35 @@ + org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.eluder.coveralls + coveralls-maven-plugin + ${coveralls-maven-plugin.version} + + + org.codehaus.mojo + cobertura-maven-plugin + ${cobertura-maven-plugin.version} - 1.6 - 1.6 + xml + 256m + + true + + + + **/*_.class + **/*_.java + + @@ -535,7 +576,7 @@ org.apache.maven.plugins maven-source-plugin - 2.1.2 + ${maven-source-plugin.version} attach-sources @@ -548,7 +589,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.7 + ${maven-javadoc-plugin.version} release-javadoc @@ -568,7 +609,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.1 + ${maven-gpg-plugin.version} sign-artifacts @@ -589,7 +630,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.7 + ${maven-javadoc-plugin.version} http://java.sun.com/j2se/1.5.0/docs/api/ diff --git a/travis/init-travis-build.sh b/travis/init-travis-build.sh new file mode 100644 index 000000000000..8796df1aaa52 --- /dev/null +++ b/travis/init-travis-build.sh @@ -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 diff --git a/travis/push-javadoc-to-gh-pages.sh b/travis/push-javadoc-to-gh-pages.sh new file mode 100644 index 000000000000..f5be844d50d9 --- /dev/null +++ b/travis/push-javadoc-to-gh-pages.sh @@ -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 "travis@travis-ci.org" + 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 diff --git a/travis/test-commit-message.sh b/travis/test-commit-message.sh new file mode 100644 index 000000000000..f4e23dcac826 --- /dev/null +++ b/travis/test-commit-message.sh @@ -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