From 0133e8876c3270cfbb31d96a79cc9bbd411e4e2d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 11 Jan 2013 21:38:21 +0100 Subject: o Trying out travis-ci.org. --- .travis-addServer.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 13 +++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .travis-addServer.py create mode 100644 .travis.yml diff --git a/.travis-addServer.py b/.travis-addServer.py new file mode 100644 index 0000000..66de4eb --- /dev/null +++ b/.travis-addServer.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +import sys +import os +import os.path +import xml.dom.minidom + +if os.environ["TRAVIS_SECURE_ENV_VARS"] == "false": + print "no secure env vars available, skipping deployment" + sys.exit() + +homedir = os.path.expanduser("~") + +m2 = xml.dom.minidom.parse(homedir + '/.m2/settings.xml') +settings = m2.getElementsByTagName("settings")[0] + +serversNodes = settings.getElementsByTagName("servers") +if not serversNodes: + serversNode = m2.createElement("servers") + settings.appendChild(serversNode) +else: + serversNode = serversNodes[0] + +sonatypeServerNode = m2.createElement("server") +sonatypeServerId = m2.createElement("id") +sonatypeServerUser = m2.createElement("username") +sonatypeServerPass = m2.createElement("password") + +idNode = m2.createTextNode("sonatype-nexus-snapshots") +userNode = m2.createTextNode(os.environ["SONATYPE_USERNAME"]) +passNode = m2.createTextNode(os.environ["SONATYPE_PASSWORD"]) + +sonatypeServerId.appendChild(idNode) +sonatypeServerUser.appendChild(userNode) +sonatypeServerPass.appendChild(passNode) + +sonatypeServerNode.appendChild(sonatypeServerId) +sonatypeServerNode.appendChild(sonatypeServerUser) +sonatypeServerNode.appendChild(sonatypeServerPass) + +serversNode.appendChild(sonatypeServerNode) + +m2Str = m2.toxml() +f = open(homedir + '/.m2/mySettings.xml', 'w') +f.write(m2Str) +f.close() diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..edfc595 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: java + +env: + global: + - SONATYPE_USERNAME=80ymBYBJ + - secure: "fWNpQtw34CGKtdzBHpawA7dQSMVQg+wg+S7lj6DtAEGJIipSPk5Uod2DYEV+\nSsP9j9yn7VAwbdo8GGqUrS0FNqKctsc6k4COOw3JMAmQEo6HEvwf7aRy/R6x\n9RgMT2YAwC34NStAC/liJunc/4a7L+QHoikr2CFImbrUn4I5+/4=" + +install: "mvn -DskipTests -U -B install" + +after_success: + - python .travis-addServer.py + # No need to run clean or run tests when simply deploying. + - mvn -DskipTests -B --settings ~/.m2/mySettings.xml deploy -- cgit v1.2.3