Skip to content

Commit

Permalink
Merge pull request #48 from paxtonhare/add_travis_support
Browse files Browse the repository at this point in the history
Add travis support
  • Loading branch information
paxtonhare committed Feb 19, 2016
2 parents 9513217 + 1927cc4 commit 41f4ef8
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: java
jdk:
- oraclejdk8
sudo: true
before_install:
- echo 'America/Los_Angeles' | sudo tee /etc/timezone
- sudo dpkg-reconfigure --frontend noninteractive tzdata
install:
- env
- if [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] ; then ./shared/dev-tasks/travis-install-ml.sh
release ; else (exit 0) ; fi
- if [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] ; then ./shared/dev-tasks/setup-marklogic.sh
; else (exit 0) ; fi
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/marklogic/data-hub-in-a-box.svg?branch=master)](https://travis-ci.org/marklogic/data-hub-in-a-box)

# Data Hub In a Box

Go from nothing to Enterprise Data Hub in a matter of minutes.
Expand Down
2 changes: 1 addition & 1 deletion data-hub/src/test/java/com/marklogic/hub/HubTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static XMLDocumentManager init() {
properties.putAll(p);
}
catch (IOException e) {
System.err.println("Properties file not loaded.");
System.err.println("gradle-local.roperties file not loaded.");
}

host = properties.getProperty("mlHost");
Expand Down
12 changes: 12 additions & 0 deletions shared/dev-tasks/setup-marklogic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

sudo /etc/init.d/MarkLogic start
sleep 10
curl -X POST -d "" http://localhost:8001/admin/v1/init
sleep 10
curl -X POST -H "Content-type: application/x-www-form-urlencoded" \
--data "admin-username=admin" \
--data "admin-password=admin" \
--data "realm=public" \
"http://localhost:8001/admin/v1/instance-admin"
sleep 10
77 changes: 77 additions & 0 deletions shared/dev-tasks/travis-install-ml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

# runs command from parameters and exits with the eoror code of the command
# if it fails
function successOrExit {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "$1 exited with error: $status"
exit $status
fi
}

set | grep TRAVIS

test $1 && arg1=$1
if [[ $arg1 = 'release' ]]; then
ver=8.0-4.2
fname=MarkLogic-${ver}.x86_64.rpm
fnamedeb="marklogic_"
fnamedeb=$fnamedeb$ver
suff="_amd64.deb"
fnamedeb=$fnamedeb$suff

curl -c cookies.txt --data "email=${MLBUILD_USER}&password=${MLBUILD_PASSWORD}" https://developer.marklogic.com/login
dl_link=$(curl -b cookies.txt --data "download=/download/binaries/8.0/${fname}" https://developer.marklogic.com/get-download-url | perl -pe 's/.*"path":"([^"]+).*/\1/')
url="https://developer.marklogic.com${dl_link}"

echo "********* Downloading MarkLogic $ver"

successOrExit curl -k -o ./$fname $url

fname=$(pwd)/$fname

sudo apt-get update
sudo apt-get install wajig alien rpm lsb-base dpkg-dev debhelper build-essential
(cd /etc && sudo ln -s default sysconfig)
sudo wajig rpminstall $fname

echo "********* MarkLogic $ver installed"
else
# find today
day=$(date +"%Y%m%d")

# if the user passed a day string as a param then use it instead
test $1 && day=$1
# make a version number out of the date
ver="8.0-$day"

echo "********* Downloading MarkLogic nightly $ver"

# fetch/install ML nightly
fname="MarkLogic-$ver.x86_64.rpm"
fnamedeb="marklogic_"
fnamedeb=$fnamedeb$ver
suff="_amd64.deb"
fnamedeb=$fnamedeb$suff

url="https://root.marklogic.com/nightly/builds/linux64/rh6-intel64-80-test-1.marklogic.com/b8_0/pkgs.$day/$fname"

status=$(curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD --head --write-out %{http_code} --silent --output /dev/null $url)
if [[ $status = 200 ]]; then
successOrExit curl -k --anyauth -u $MLBUILD_USER:$MLBUILD_PASSWORD -o ./$fname $url

fname=$(pwd)/$fname

sudo apt-get update
sudo apt-get install alien dpkg-dev debhelper build-essential
sudo alien -d -k $fname
sudo dpkg -i $fnamedeb

echo "********* MarkLogic nightly $ver installed"
else
echo "CANNOT DOWNLOAD: status = $status for date $day (URL=\"$url\")"
exit 1
fi
fi

0 comments on commit 41f4ef8

Please sign in to comment.