|
16 | 16 | #
|
17 | 17 |
|
18 | 18 |
|
19 |
| -# Get Project Repo |
20 |
| -mybatis_repo=$(git config --get remote.origin.url 2>&1) |
21 |
| -echo "Repo detected: ${mybatis_repo}" |
22 |
| - |
23 | 19 | # Get Commit Message
|
24 | 20 | commit_message=$(git log --format=%B -n 1)
|
25 | 21 | echo "Current commit detected: ${commit_message}"
|
26 | 22 |
|
27 |
| -# Get the Java version. |
28 |
| -# Java 1.5 will give 15. |
29 |
| -# Java 1.6 will give 16. |
30 |
| -# Java 1.7 will give 17. |
31 |
| -# Java 1.8 will give 18. |
32 |
| -VER=`java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q'` |
33 |
| -echo "Java detected: ${VER}" |
34 |
| - |
35 | 23 | # We build for several JDKs on Travis.
|
36 | 24 | # Some actions, like analyzing the code (Coveralls) and uploading
|
37 | 25 | # artifacts on a Maven repository, should only be made for one version.
|
38 | 26 |
|
39 |
| -# If the version is 1.6, then perform the following actions. |
| 27 | +# If the version is 1.8, then perform the following actions. |
40 | 28 | # 1. Upload artifacts to Sonatype.
|
41 | 29 | # 2. Use -q option to only display Maven errors and warnings.
|
42 | 30 | # 3. Use --settings to force the usage of our "settings.xml" file.
|
| 31 | +# 4. Notify Coveralls. |
| 32 | +# 5. Deploy site |
| 33 | +# 6. Notify Sonar |
| 34 | + |
| 35 | +if [ $TRAVIS_REPO_SLUG == "mybatis/spring" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [[ "$commit_message" != *"[maven-release-plugin]"* ]]; then |
43 | 36 |
|
44 |
| -# If the version is 1.7, then perform the following actions. |
45 |
| -# 1. Notify Coveralls. |
46 |
| -# 2. Deploy site |
47 |
| -# 3. Use -q option to only display Maven errors and warnings. |
| 37 | + if [ $VER == "18" ]; then |
48 | 38 |
|
49 |
| -if [ "$mybatis_repo" == "https://github.com/mybatis/spring.git" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [[ "$commit_message" != *"[maven-release-plugin]"* ]]; then |
50 |
| - if [ $VER == "16" ]; then |
51 |
| - mvn clean deploy -q --settings ./travis/settings.xml |
| 39 | + # Deploy to sonatype |
| 40 | + ./mvnw clean deploy -q --settings ./travis/settings.xml |
52 | 41 | echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}"
|
53 |
| - elif [ $VER == "18" ]; then |
54 |
| - mvn clean test jacoco:report coveralls:report -q |
| 42 | + |
| 43 | + # Deploy to coveralls |
| 44 | + ./mvnw clean test jacoco:report coveralls:report -q --settings ./travis/settings.xml |
55 | 45 | echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}"
|
56 |
| - # various issues exist currently in building this so comment for now |
57 |
| - # mvn site site:deploy -q |
| 46 | + |
| 47 | + # Deploy to site |
| 48 | + # Cannot currently run site this way |
| 49 | + # ./mvnw site site:deploy -q |
58 | 50 | # echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
|
59 |
| - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=ccf0be39fd0ca5ea5aa712247c79da7233cd3caa |
| 51 | + |
| 52 | + # Notify Sonar |
| 53 | + ./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=ccf0be39fd0ca5ea5aa712247c79da7233cd3caa |
60 | 54 | echo -e "Successfully ran Sonar integration under Travis job ${TRAVIS_JOB_NUMBER}"
|
| 55 | + else |
| 56 | + echo "Java Version does not support additonal activity for travis CI" |
61 | 57 | fi
|
62 | 58 | else
|
| 59 | + echo "Travis Pull Request: $TRAVIS_PULL_REQUEST" |
| 60 | + echo "Travis Branch: $TRAVIS_BRANCH" |
63 | 61 | echo "Travis build skipped"
|
64 | 62 | fi
|
0 commit comments