ci: Enable scripts for Travis-CI and in-house Jenkins CI
Change-Id: Ibd4c0313945d57a037e87c54c56e6047c4daed73
Refs: #2477
diff --git a/.gitmodules b/.gitmodules
index aa05731..e6c1609 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ChronoSync"]
path = ChronoSync
- url = https://github.com/bruinfish/ChronoSync.git
+ url = ../ChronoSync.git
branch = master
diff --git a/.jenkins b/.jenkins
new file mode 100755
index 0000000..674d751
--- /dev/null
+++ b/.jenkins
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -e
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+for file in "$DIR"/.jenkins.d/*; do
+ [[ -f $file && -x $file ]] || continue
+ echo "Run: $file"
+ "$file"
+done
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..07f904c
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+[[ -n $NODE_LABELS ]] || exit 0
+
+if has OSX $NODE_LABELS; then
+ brew update
+ brew upgrade
+ brew install boost pkg-config qt4
+ brew cleanup
+fi
+
+if has Ubuntu $NODE_LABELS; then
+ sudo apt-get update -qq -y
+ sudo apt-get -qq -y install build-essential
+ sudo apt-get -qq -y install libssl-dev libsqlite3-dev
+
+ if has Ubuntu-12.04 $NODE_LABELS; then
+ sudo apt-get install -qq -y libboost1.48-all-dev
+ else
+ sudo apt-get install -qq -y libboost-all-dev
+ fi
+
+ sudo apt-get install -qq -y qt4-dev-tools protobuf-compiler libprotobuf-dev libqt4-sql-sqlite
+fi
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/10-ndn-cxx.sh
new file mode 100755
index 0000000..2af7d6a
--- /dev/null
+++ b/.jenkins.d/10-ndn-cxx.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+pushd /tmp >/dev/null
+
+INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
+
+sudo rm -Rf ndn-cxx-latest
+git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
+LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+
+if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
+ sudo rm -Rf ndn-cxx
+ mv ndn-cxx-latest ndn-cxx
+else
+ sudo rm -Rf ndn-cxx-latest
+fi
+
+sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/lib/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+
+pushd ndn-cxx >/dev/null
+
+./waf configure -j1 --color=yes --without-osx-keychain
+./waf -j1 --color=yes
+sudo ./waf install -j1 --color=yes
+
+popd >/dev/null
+popd >/dev/null
diff --git a/.jenkins.d/11-chronosync.sh b/.jenkins.d/11-chronosync.sh
new file mode 100755
index 0000000..78aeab1
--- /dev/null
+++ b/.jenkins.d/11-chronosync.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+sudo rm -Rf /usr/local/include/ChronoSync
+sudo rm -f /usr/local/lib/libChronoSync*
+sudo rm -f /usr/local/lib/pkgconfig/ChronoSync*
+
+
+# Update ChronoSync
+git submodule init
+git submodule update
+pushd ChronoSync >/dev/null
+sudo ./waf -j1 --color=yes distclean
+./waf -j1 --color=yes configure
+./waf -j1 --color=yes build
+sudo ./waf install -j1 --color=yes
+sudo ldconfig || true
+popd >/dev/null
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
new file mode 100755
index 0000000..e64e944
--- /dev/null
+++ b/.jenkins.d/20-build.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+# Cleanup
+sudo ./waf -j1 --color=yes distclean
+
+# Configure/build in release mode
+./waf -j1 --color=yes configure
+./waf -j1 --color=yes build
+
+# Cleanup
+sudo ./waf -j1 --color=yes distclean
+
+# Configure/build in debug mode
+./waf -j1 --color=yes configure --debug
+./waf -j1 --color=yes build
+
+# Cleanup
+sudo ./waf -j1 --color=yes distclean
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
new file mode 100644
index 0000000..81c8931
--- /dev/null
+++ b/.jenkins.d/util.sh
@@ -0,0 +1,9 @@
+has() {
+ local p=$1
+ shift
+ local x
+ for x in "$@"; do
+ [[ "${x}" == "${p}" ]] && return 0
+ done
+ return 1
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..3ad69cd
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+# For Ubuntu platform only
+
+language: cpp
+os:
+ - linux
+compiler:
+ - gcc
+notifications:
+ email:
+ on_success: always
+ on_failure: always
+before_install:
+ - travis_retry sudo apt-get update
+ - travis_retry sudo apt-get install -qq libssl-dev libprotobuf-dev protobuf-compiler libboost1.48-all-dev libcrypto++-dev libsqlite3-dev
+script:
+ - ./.jenkins
diff --git a/ChronoSync b/ChronoSync
index 906c2ea..8fb88f1 160000
--- a/ChronoSync
+++ b/ChronoSync
@@ -1 +1 @@
-Subproject commit 906c2eab6dc58eeb86b85e635b47606edb684e9c
+Subproject commit 8fb88f1ced9f13bc39514e42a66dc09bee2d9f3f
diff --git a/src/chat-dialog-backend.cpp b/src/chat-dialog-backend.cpp
index bedb45d..3e77b53 100644
--- a/src/chat-dialog-backend.cpp
+++ b/src/chat-dialog-backend.cpp
@@ -120,7 +120,7 @@
std::vector<NodeInfo> nodeInfos;
- for (int i = 0; i < updates.size(); i++) {
+ for (size_t i = 0; i < updates.size(); i++) {
// update roster
if (m_roster.find(updates[i].session) == m_roster.end()) {
m_roster[updates[i].session].sessionPrefix = updates[i].session;
diff --git a/src/chatroom-info.cpp b/src/chatroom-info.cpp
index f6b81e3..9dc3439 100644
--- a/src/chatroom-info.cpp
+++ b/src/chatroom-info.cpp
@@ -72,7 +72,7 @@
totalLength += block.prependVarNumber(tlv::ChatroomPrefix);
// Trust Model
- totalLength += prependNonNegativeIntegerBlock(block, tlv::TrustModel, m_trustModel);
+ totalLength += ndn::prependNonNegativeIntegerBlock(block, tlv::TrustModel, m_trustModel);
// Chatroom Name
size_t chatroomNameLength = m_chatroomName.wireEncode(block);
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 69c2d4b..89f4ea3 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -252,10 +252,10 @@
catch(Block::Error& e) {
emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
}
- catch(Data::Error& e) {
+ catch(EndorseCertificate::Error& e) {
emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
}
- catch(EndorseCertificate::Error& e) {
+ catch(Data::Error& e) {
emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
}
}
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index c894849..20c6983 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -382,7 +382,7 @@
sqlite3_bind_int64(stmt, 6, time::toUnixTimestamp(contact.getNotAfter()).count());
sqlite3_bind_int(stmt, 7, (isIntroducer ? 1 : 0));
- int res = sqlite3_step(stmt);
+ sqlite3_step(stmt);
sqlite3_finalize(stmt);
@@ -396,7 +396,7 @@
sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
sqlite3_bind_string(stmt, 2, it->first, SQLITE_TRANSIENT);
sqlite3_bind_string(stmt, 3, it->second, SQLITE_TRANSIENT);
- res = sqlite3_step(stmt);
+ sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
@@ -410,7 +410,7 @@
-1, &stmt, 0);
sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
sqlite3_bind_string(stmt, 2, it->first.toUri(), SQLITE_TRANSIENT);
- res = sqlite3_step(stmt);
+ sqlite3_step(stmt);
sqlite3_finalize(stmt);
it++;
}
diff --git a/src/digest-tree-scene.cpp b/src/digest-tree-scene.cpp
index e7adba9..b09d241 100644
--- a/src/digest-tree-scene.cpp
+++ b/src/digest-tree-scene.cpp
@@ -43,7 +43,7 @@
bool rePlot = false;
// Update roster info
- for (int i = 0; i < nodeInfos.size(); i++) {
+ for (size_t i = 0; i < nodeInfos.size(); i++) {
Roster_iterator it = m_roster.find(nodeInfos[i].sessionPrefix);
if (it == m_roster.end()) {
rePlot = true;
@@ -63,7 +63,7 @@
plot(m_rootDigest);
else {
// No new node, update seqNo & digest
- for (int i = 0; i < nodeInfos.size(); i++) {
+ for (size_t i = 0; i < nodeInfos.size(); i++) {
Roster_iterator it = m_roster.find(nodeInfos[i].sessionPrefix);
if (it != m_roster.end()) {
DisplayUserPtr p = it.value();
diff --git a/src/digest-tree-scene.hpp b/src/digest-tree-scene.hpp
index 51847dc..4cf4d7f 100644
--- a/src/digest-tree-scene.hpp
+++ b/src/digest-tree-scene.hpp
@@ -19,10 +19,8 @@
#ifndef Q_MOC_RUN
#include "tree-layout.hpp"
#include "chat-dialog-backend.hpp"
-#include <Leaf.hpp>
#include <ctime>
#include <vector>
-#include <boost/shared_ptr.hpp>
#endif
const int FRESHNESS = 60;
@@ -33,7 +31,7 @@
class User;
class DisplayUser;
-typedef boost::shared_ptr<DisplayUser> DisplayUserPtr;
+typedef std::shared_ptr<DisplayUser> DisplayUserPtr;
typedef QMap<QString, DisplayUserPtr> Roster;
typedef QMap<QString, DisplayUserPtr>::iterator Roster_iterator;
typedef QMapIterator<QString, DisplayUserPtr> RosterIterator;