Skip to content

Commit

Permalink
Merge 12fec2f into e8dcb8b
Browse files Browse the repository at this point in the history
  • Loading branch information
jewzaam committed Jan 22, 2015
2 parents e8dcb8b + 12fec2f commit b47ece5
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 58 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
language: java
jdk:
- openjdk7
- oraclejdk8
before_install:
- cp ./etc/settings.xml ~/.m2/
- cp ./etc/onFailure.sh ~/
- cp ./etc/onSuccess.sh ~/
- chmod 777 ~/onFailure.sh
- chmod 777 ~/onSuccess.sh
script:
- mvn -B clean verify cobertura:cobertura coveralls:report
after_failure: ~/onFailure.sh
after_success: ~/onSuccess.sh
notifications:
email: false
irc:
channels:
- chat.freenode.net#lightblue
on_success: always
env:
global:
- secure: KUsWgSyKeNX8dIs/lKdxsgsXub98d1pqSqEFuEGMEvrxGoFaB63B1zoIwYI5uzv67Ir36N0H7GVgeqYsELKaU8mMcRevd/FXkALuGyUdS8/pbiXVEYtDDdWZP1VYF/p4cm3+ZzvEIhqj8ZgLWeIlXpIRYm4WAsnDzrTEG93INgk=
- secure: q/2hWviyGa/Kr7zWes9f6gIW3rJ7xf7lh5tMFrtvNuhfEO4XRra+ZYG5yBHgvvLu+J/AaksmU4SBDmEY85GuLn5uh25s6OM9vwhnpJ9lz7FQ6jK6Jnm7IwMuHYIuTTXf5m702APingF73dkYijxgMnyOK9EEHE5/cWEgznOizY4=
6 changes: 6 additions & 0 deletions etc/onFailure.sh
@@ -0,0 +1,6 @@
#!/usr/bin/env sh

echo "DEBUG TRAVIS BUILD FAILURE"
echo "Current directory is $(pwd)"
echo "Sunfire reports"
for i in `find . -type d -name surefire-reports` ; do for f in $i/*.txt; do echo $f : `cat $f`; done done
5 changes: 5 additions & 0 deletions etc/onSuccess.sh
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

echo "DEPLOY MASTER TRAVIS BUILD"
echo "Current directory is $(pwd)"
'[[ $TRAVIS_BRANCH == "master" ]] && [[ $TRAVIS_JDK_VERSION == "openjdk7" ]] && { mvn clean deploy -DskipTests; };'
53 changes: 53 additions & 0 deletions etc/release.sh
@@ -0,0 +1,53 @@
#!/bin/sh

# https://github.com/lightblue-platform/lightblue-docs-developer/issues/6

RELEASE_VERSION=$1
DEVEL_VERSION=$2

if [ $1"x" == "x" ] || [ $2"x" == "x" ]; then
echo "Usage: ./release.sh <release version> <new snapshot version>"
echo "Example: ./release 1.1.0 1.2.0-SNAPSHOT"
exit 1
fi

# prepare and verify state
git fetch --all
rm -rf ~/.m2/repository/com/redhat/lightblue/

BRANCH=`git branch | grep ^* | awk '{print $2}'`

if [ $BRANCH != "master" ]; then
read -p "Current branch is '${BRANCH}', not 'master'. Do you wish to continue? (y/N) "
if [ "$REPLY" != "y"]; then
exit 1
fi
fi

# check that local branch is equal to upstream master (assumes remote of origin)
MERGE_BASE=`git merge-base HEAD origin/master`
HEAD_HASH=`git rev-parse HEAD`

if [ $MERGE_BASE != $HEAD_HASH ]; then
echo "Local branch is not in sync with origin/master. Fix and run this script again."
exit 1
fi

# update to non-snapshot versions of lightblue dependencies and commit
mvn versions:update-properties -DallowSnapshots=false
git commit -a -m "Updated versions to non snapshot"

# prepare for release (note, this will warn if any snapshot dependencies still exist and allow for fixing)
mvn release:prepare -P release \
-DpushChanges=false \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$DEVEL_VERSION \
-Dtag=V${RELEASE_VERSION} || exit

# push prepared changes (doing separate just to have control)
git push origin master --tags

# perform release
mvn release:perform -P release || exit

mvn clean deploy
54 changes: 54 additions & 0 deletions etc/release.sh~HEAD
@@ -0,0 +1,54 @@
#!/bin/sh

# https://github.com/lightblue-platform/lightblue-docs-developer/issues/6

RELEASE_VERSION=$1
DEVEL_VERSION=$2

if [ $1"x" == "x" ] || [ $2"x" == "x" ]; then
echo "Usage: ./release.sh <release version> <new snapshot version>"
echo "Example: ./release 1.1.0 1.2.0-SNAPSHOT"
exit 1
fi

# prepare and verify state
git fetch --all

BRANCH=`git branch | grep ^* | awk '{print $2}'`

if [ $BRANCH != "master" ]; then
read -p "Current branch is '${BRANCH}', not 'master'. Do you wish to continue? (y/N) "
if [ "$REPLY" != "y"]; then
exit 1
fi
fi

# check that local branch is equal to upstream master (assumes remote of origin)
MERGE_BASE=`git merge-base HEAD origin/master`
HEAD_HASH=`git rev-parse HEAD`

if [ $MERGE_BASE != $HEAD_HASH ]; then
echo "Local branch is not in sync with origin/master. Fix and run this script again."
exit 1
fi

# update to non-snapshot versions of lightblue dependencies and commit
mvn versions:update-properties -DallowSnapshots=false
git commit -a -m "Updated versions to non snapshot"

# prepare for release (note, this will warn if any snapshot dependencies still exist and allow for fixing)
mvn release:prepare -P release \
-DpushChanges=false \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$DEVEL_VERSION \
-Dtag=V${RELEASE_VERSION} || exit

# push prepared changes (doing separate just to have control)
git push origin master --tags

# perform release
mvn release:perform -P release || exit

mvn versions:set -DnewVersion=$DEVEL_VERSION

mvn clean deploy
42 changes: 42 additions & 0 deletions etc/settings.xml
@@ -0,0 +1,42 @@
<settings>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
17 changes: 17 additions & 0 deletions etc/sonar.sh
@@ -0,0 +1,17 @@
#!/bin/sh

# kill any previous port forward
pkill -9 -f "rhc port-forward sonar [-]n lightblue"

# forward ports from openshift (assumes current server is openshift online and you're a member of the lightblue namespace)
rhc port-forward sonar -n lightblue &

# wait a bit for port forwarding to fire up
sleep 10

# build and publish
mvn clean install -Dmaven.test.failure.ignore=true
mvn -e -B sonar:sonar

# cleanup port forwarding
pkill -9 -f "rhc port-forward sonar [-]n lightblue"
150 changes: 92 additions & 58 deletions pom.xml
Expand Up @@ -47,6 +47,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<sourceEncoding>UTF-8</sourceEncoding>
<sonar.exclusions>**/*Test.java,**/*Exception.java</sonar.exclusions>
<sonar.jdbc.url>jdbc:mysql://127.0.0.1:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true</sonar.jdbc.url>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://127.0.0.1:8080</sonar.host.url>
<sonar.projectName>smoneky</sonar.projectName>
</properties>
<build>
<plugins>
<plugin>
Expand All @@ -58,6 +67,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<format>xml</format>
<maxmem>256m</maxmem>
<!-- aggregated reports for multi-module projects -->
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
Expand All @@ -83,64 +108,73 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-2</version>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>2014, Red Hat, Inc. and/or its affiliates.</copyright>
<name>${project.artifactId}</name>
<release>1</release>
<group>Applications/File</group>
<specfileName>redhat-sd-${project.artifactId}.spec</specfileName>
<defaultDirmode>755</defaultDirmode>
<mappings>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<filemode>755</filemode>
</mapping>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<sources>
<source>
<location>target/smonkey-app.jar</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<filemode>755</filemode>
<sources>
<source>
<location>smonkey</location>
</source>
<source>
<location>LICENSE</location>
</source>
<source>
<location>README.md</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/bin</directory>
<sources>
<softlinkSource>
<destination>smonkey</destination>
<location>/usr/share/smonkey-${project.version}/smonkey</location>
</softlinkSource>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>rpm</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-2</version>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>2014, Red Hat, Inc. and/or its affiliates.</copyright>
<name>${project.artifactId}</name>
<release>1</release>
<group>Applications/File</group>
<specfileName>redhat-sd-${project.artifactId}.spec</specfileName>
<defaultDirmode>755</defaultDirmode>
<mappings>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<filemode>755</filemode>
</mapping>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<sources>
<source>
<location>target/smonkey-app.jar</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/share/smonkey-${project.version}</directory>
<filemode>755</filemode>
<sources>
<source>
<location>smonkey</location>
</source>
<source>
<location>LICENSE</location>
</source>
<source>
<location>README.md</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/bin</directory>
<sources>
<softlinkSource>
<destination>smonkey</destination>
<location>/usr/share/smonkey-${project.version}/smonkey</location>
</softlinkSource>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit b47ece5

Please sign in to comment.