Skip to content

Commit 31d9760

Browse files
committed
[travis] reworking build
1 parent 65ab07d commit 31d9760

File tree

4 files changed

+65
-7
lines changed

4 files changed

+65
-7
lines changed

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
language: java
2+
sudo: false
3+
24
jdk:
35
- oraclejdk8
46
- oraclejdk7
57
- openjdk7
68
- openjdk6
7-
after_success:
8-
- "git clone -b travis `git config --get remote.origin.url` target/travis"
9-
- "mvn deploy --settings target/travis/settings.xml"
109

11-
branches:
12-
except:
13-
- travis
10+
after_success:
11+
- chmod -R 777 ./travis/after_success.sh
12+
- ./travis/after_success.sh
1413

1514
env:
1615
global:

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
<parent>
2121
<groupId>org.mybatis</groupId>
2222
<artifactId>mybatis-parent</artifactId>
23-
<version>25</version>
23+
<version>26-SNAPSHOT</version>
24+
<relativePath />
2425
</parent>
2526

2627
<groupId>org.mybatis.scripting</groupId>

travis/after_success.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# Get Project Repo
4+
mybatis_repo=$(git config --get remote.origin.url 2>&1)
5+
echo "Repo detected: ${mybatis_repo}"
6+
7+
# Get the Java version.
8+
# Java 1.5 will give 15.
9+
# Java 1.6 will give 16.
10+
# Java 1.7 will give 17.
11+
# Java 1.8 will give 18.
12+
VER=`java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q'`
13+
echo "Java detected: ${VER}"
14+
15+
# We build for several JDKs on Travis.
16+
# Some actions, like analyzing the code (Coveralls) and uploading
17+
# artifacts on a Maven repository, should only be made for one version.
18+
19+
# If the version is 1.6, then perform the following actions.
20+
# 1. Upload artifacts to Sonatype.
21+
# 2. Use -q option to only display Maven errors and warnings.
22+
# 3. Use --settings to force the usage of our "settings.xml" file.
23+
24+
# If the version is 1.7, then perform the following actions.
25+
# 1. Notify Coveralls.
26+
# 2. Deploy site
27+
# 3. Use -q option to only display Maven errors and warnings.
28+
29+
if [ "$mybatis_repo" == "https://github.com/mybatis/velocity-scripting.git" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
30+
if [ $VER == "16" ]; then
31+
mvn clean deploy -q --settings ./travis/settings.xml
32+
echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}"
33+
elif [ $VER == "17" ]; then
34+
mvn clean test jacoco:report coveralls:report -q
35+
echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}"
36+
# various issues exist currently in building this so comment for now
37+
# mvn site site:deploy -q
38+
# echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
39+
fi
40+
else
41+
echo "Travis build skipped"
42+
fi

travis/settings.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
4+
<servers>
5+
<server>
6+
<id>ossrh</id>
7+
<username>${env.CI_DEPLOY_USERNAME}</username>
8+
<password>${env.CI_DEPLOY_PASSWORD}</password>
9+
</server>
10+
<server>
11+
<id>gh-pages</id>
12+
<username>git</username>
13+
<password>${env.CI_SITE_PASSWORD}</password>
14+
</server>
15+
</servers>
16+
</settings>

0 commit comments

Comments
 (0)