Skip to content

Commit 049fea8

Browse files
committed
Merge pull request #35 from luan-cestari/travis_update
Travis update
2 parents 690bb5c + acd2141 commit 049fea8

File tree

6 files changed

+142
-11
lines changed

6 files changed

+142
-11
lines changed

.travis.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
language: java
22
jdk:
3-
- openjdk7
4-
- oraclejdk8
3+
- openjdk7
4+
- oraclejdk8
55
before_install:
6-
- cp ./settings.xml ~/.m2/
7-
after_success:
8-
- '[[ $TRAVIS_BRANCH == "master" ]] && [[ $TRAVIS_JDK_VERSION == "openjdk7" ]] &&
9-
{ mvn clean deploy -DskipTests; };'
10-
- mvn clean verify cobertura:cobertura coveralls:report
6+
- cp ./etc/settings.xml ~/.m2/
7+
- cp ./etc/onFailure.sh ~/
8+
- cp ./etc/onSuccess.sh ~/
9+
- chmod 777 ~/onFailure.sh
10+
- chmod 777 ~/onSuccess.sh
11+
script:
12+
- mvn -B clean verify cobertura:cobertura coveralls:report
13+
after_failure: ~/onFailure.sh
14+
after_success: ~/onSuccess.sh
1115
notifications:
12-
email: false
13-
irc:
14-
channels:
15-
- chat.freenode.net#lightblue
16+
email: false
17+
irc:
18+
channels:
19+
- chat.freenode.net#lightblue
1620
on_success: always
21+
env:
22+
global:
23+
- secure: KUsWgSyKeNX8dIs/lKdxsgsXub98d1pqSqEFuEGMEvrxGoFaB63B1zoIwYI5uzv67Ir36N0H7GVgeqYsELKaU8mMcRevd/FXkALuGyUdS8/pbiXVEYtDDdWZP1VYF/p4cm3+ZzvEIhqj8ZgLWeIlXpIRYm4WAsnDzrTEG93INgk=
24+
- secure: q/2hWviyGa/Kr7zWes9f6gIW3rJ7xf7lh5tMFrtvNuhfEO4XRra+ZYG5yBHgvvLu+J/AaksmU4SBDmEY85GuLn5uh25s6OM9vwhnpJ9lz7FQ6jK6Jnm7IwMuHYIuTTXf5m702APingF73dkYijxgMnyOK9EEHE5/cWEgznOizY4=

etc/onFailure.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
3+
echo "DEBUG TRAVIS BUILD FAILURE"
4+
echo "Current directory is $(pwd)"
5+
echo "Sunfire reports"
6+
for i in `find . -type d -name surefire-reports` ; do for f in $i/*.txt; do echo $f : `cat $f`; done done

etc/onSuccess.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
echo "DEPLOY MASTER TRAVIS BUILD"
4+
echo "Current directory is $(pwd)"
5+
'[[ $TRAVIS_BRANCH == "master" ]] && [[ $TRAVIS_JDK_VERSION == "openjdk7" ]] && { mvn clean deploy -DskipTests; };'

etc/release.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
3+
# https://github.com/lightblue-platform/lightblue-docs-developer/issues/6
4+
5+
RELEASE_VERSION=$1
6+
DEVEL_VERSION=$2
7+
8+
if [ $1"x" == "x" ] || [ $2"x" == "x" ]; then
9+
echo "Usage: ./release.sh <release version> <new snapshot version>"
10+
echo "Example: ./release 1.1.0 1.2.0-SNAPSHOT"
11+
exit 1
12+
fi
13+
14+
# prepare and verify state
15+
git fetch --all
16+
rm -rf ~/.m2/repository/com/redhat/lightblue/
17+
18+
BRANCH=`git branch | grep ^* | awk '{print $2}'`
19+
20+
if [ $BRANCH != "master" ]; then
21+
read -p "Current branch is '${BRANCH}', not 'master'. Do you wish to continue? (y/N) "
22+
if [ "$REPLY" != "y"]; then
23+
exit 1
24+
fi
25+
fi
26+
27+
# check that local branch is equal to upstream master (assumes remote of origin)
28+
MERGE_BASE=`git merge-base HEAD origin/master`
29+
HEAD_HASH=`git rev-parse HEAD`
30+
31+
if [ $MERGE_BASE != $HEAD_HASH ]; then
32+
echo "Local branch is not in sync with origin/master. Fix and run this script again."
33+
exit 1
34+
fi
35+
36+
# update to non-snapshot versions of lightblue dependencies and commit
37+
mvn versions:update-properties -DallowSnapshots=false
38+
git commit -a -m "Updated versions to non snapshot"
39+
40+
# prepare for release (note, this will warn if any snapshot dependencies still exist and allow for fixing)
41+
mvn release:prepare -P release \
42+
-DpushChanges=false \
43+
-DreleaseVersion=$RELEASE_VERSION \
44+
-DdevelopmentVersion=$DEVEL_VERSION \
45+
-Dtag=V${RELEASE_VERSION} || exit
46+
47+
# push prepared changes (doing separate just to have control)
48+
git push origin master --tags
49+
50+
# perform release
51+
mvn release:perform -P release || exit
52+
53+
mvn clean deploy

etc/settings.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<settings>
2+
<activeProfiles>
3+
<!--make the profile active all the time -->
4+
<activeProfile>securecentral</activeProfile>
5+
</activeProfiles>
6+
<profiles>
7+
<profile>
8+
<id>securecentral</id>
9+
<!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
10+
<repositories>
11+
<repository>
12+
<id>central</id>
13+
<url>https://repo1.maven.org/maven2</url>
14+
<releases>
15+
<enabled>true</enabled>
16+
</releases>
17+
</repository>
18+
</repositories>
19+
<pluginRepositories>
20+
<pluginRepository>
21+
<id>central</id>
22+
<url>https://repo1.maven.org/maven2</url>
23+
<releases>
24+
<enabled>true</enabled>
25+
</releases>
26+
</pluginRepository>
27+
</pluginRepositories>
28+
</profile>
29+
</profiles>
30+
<servers>
31+
<server>
32+
<id>sonatype-nexus-snapshots</id>
33+
<username>${env.SONATYPE_USERNAME}</username>
34+
<password>${env.SONATYPE_PASSWORD}</password>
35+
</server>
36+
<server>
37+
<id>sonatype-nexus-staging</id>
38+
<username>${env.SONATYPE_USERNAME}</username>
39+
<password>${env.SONATYPE_PASSWORD}</password>
40+
</server>
41+
</servers>
42+
</settings>

etc/sonar.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# kill any previous port forward
4+
pkill -9 -f "rhc port-forward sonar [-]n lightblue"
5+
6+
# forward ports from openshift (assumes current server is openshift online and you're a member of the lightblue namespace)
7+
rhc port-forward sonar -n lightblue &
8+
9+
# wait a bit for port forwarding to fire up
10+
sleep 10
11+
12+
# build and publish
13+
mvn clean install -Dmaven.test.failure.ignore=true
14+
mvn -e -B sonar:sonar
15+
16+
# cleanup port forwarding
17+
pkill -9 -f "rhc port-forward sonar [-]n lightblue"

0 commit comments

Comments
 (0)