Skip to content

Commit

Permalink
Merge pull request #24 from hazendaz/master
Browse files Browse the repository at this point in the history
Reworking builds
  • Loading branch information
hazendaz committed Oct 11, 2015
2 parents 6f2dfc8 + fe6d46a commit 79528c3
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
language: java
sudo: false

jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- openjdk6
after_success:
- "git clone -b travis `git config --get remote.origin.url` target/travis"
- "mvn deploy --settings target/travis/settings.xml"

branches:
except:
- travis
after_success:
- chmod -R 777 ./travis/after_success.sh
- ./travis/after_success.sh

env:
global:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ MyBatis Ehcache Extension
=========================

[![Build Status](https://travis-ci.org/mybatis/ehcache-cache.svg?branch=master)](https://travis-ci.org/mybatis/ehcache-cache)
[![Coverage Status](https://coveralls.io/repos/mybatis/ehcache-cache/badge.svg?branch=master&service=github)](https://coveralls.io/github/mybatis/ehcache-cache?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/560f3b3b5a262f001a000a20/badge.svg?style=flat)](https://www.versioneye.com/user/projects/560f3b3b5a262f001a000a20)
[![Maven central](https://maven-badges.herokuapp.com/maven-central/org.mybatis.caches/mybatis-ehcache/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mybatis.caches/mybatis-ehcache)
[![Apache 2](http://img.shields.io/badge/license-Apache%202-red.svg)](http://www.apache.org/licenses/LICENSE-2.0)

![mybatis-cdi](http://mybatis.github.io/images/mybatis-logo.png)

Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<parent>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-parent</artifactId>
<version>25</version>
<version>26-SNAPSHOT</version>
<relativePath />
</parent>

<groupId>org.mybatis.caches</groupId>
Expand Down
42 changes: 42 additions & 0 deletions travis/after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Get Project Repo
mybatis_repo=$(git config --get remote.origin.url 2>&1)
echo "Repo detected: ${mybatis_repo}"

# Get the Java version.
# Java 1.5 will give 15.
# Java 1.6 will give 16.
# Java 1.7 will give 17.
# Java 1.8 will give 18.
VER=`java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q'`
echo "Java detected: ${VER}"

# We build for several JDKs on Travis.
# Some actions, like analyzing the code (Coveralls) and uploading
# artifacts on a Maven repository, should only be made for one version.

# If the version is 1.6, then perform the following actions.
# 1. Upload artifacts to Sonatype.
# 2. Use -q option to only display Maven errors and warnings.
# 3. Use --settings to force the usage of our "settings.xml" file.

# If the version is 1.7, then perform the following actions.
# 1. Notify Coveralls.
# 2. Deploy site
# 3. Use -q option to only display Maven errors and warnings.

if [ "$mybatis_repo" == "https://github.com/mybatis/ehcache-cache.git" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
if [ $VER == "16" ]; then
mvn clean deploy -q --settings ./travis/settings.xml
echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}"
elif [ $VER == "17" ]; then
mvn clean test jacoco:report coveralls:report -q
echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}"
# various issues exist currently in building this so comment for now
# mvn site site:deploy -q
# echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
fi
else
echo "Travis build skipped"
fi
16 changes: 16 additions & 0 deletions travis/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>gh-pages</id>
<username>git</username>
<password>${env.CI_SITE_PASSWORD}</password>
</server>
</servers>
</settings>

0 comments on commit 79528c3

Please sign in to comment.