Skip to content

Commit

Permalink
ci: Enable scripts for Travis-CI and in-house Jenkins CI
Browse files Browse the repository at this point in the history
Change-Id: Ibd4c0313945d57a037e87c54c56e6047c4daed73
Refs: #2477
  • Loading branch information
bruinfish committed Feb 25, 2015
1 parent 4647f02 commit 1cc45d9
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "ChronoSync"]
path = ChronoSync
url = https://github.com/bruinfish/ChronoSync.git
url = ../ChronoSync.git
branch = master
10 changes: 10 additions & 0 deletions .jenkins
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions .jenkins.d/00-deps.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .jenkins.d/10-ndn-cxx.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions .jenkins.d/11-chronosync.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions .jenkins.d/20-build.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .jenkins.d/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
has() {
local p=$1
shift
local x
for x in "$@"; do
[[ "${x}" == "${p}" ]] && return 0
done
return 1
}
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/chat-dialog-backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ChatDialogBackend::processSyncUpdate(const std::vector<chronosync::MissingDataIn
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;
Expand Down
2 changes: 1 addition & 1 deletion src/chatroom-info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ChatroomInfo::wireEncode(ndn::EncodingImpl<T>& block) const
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);
Expand Down
4 changes: 2 additions & 2 deletions src/contact-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ ContactManager::onDnsSelfEndorseCertValidated(const shared_ptr<const Data>& data
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()));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/contact-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ ContactStorage::addContact(const Contact& contact)
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);

Expand All @@ -396,7 +396,7 @@ ContactStorage::addContact(const Contact& contact)
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);
}

Expand All @@ -410,7 +410,7 @@ ContactStorage::addContact(const Contact& contact)
-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++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/digest-tree-scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ DigestTreeScene::processSyncUpdate(const std::vector<chronos::NodeInfo>& nodeInf
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;
Expand All @@ -63,7 +63,7 @@ DigestTreeScene::processSyncUpdate(const std::vector<chronos::NodeInfo>& nodeInf
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();
Expand Down
4 changes: 1 addition & 3 deletions src/digest-tree-scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,7 +31,7 @@ namespace chronos {

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;
Expand Down

0 comments on commit 1cc45d9

Please sign in to comment.