build+ci: update scripts
Change-Id: Ica98e8b64c26cfeb0c45f18b086ae87c28ca3dbc
This commit is contained in:
+12
-3
@@ -7,14 +7,23 @@ source "$JDIR"/util.sh
|
||||
set -x
|
||||
|
||||
if has OSX $NODE_LABELS; then
|
||||
FORMULAE=(boost openssl pkg-config)
|
||||
brew update
|
||||
if [[ -n $TRAVIS ]]; then
|
||||
# travis images come with a large number of brew packages
|
||||
# pre-installed, don't waste time upgrading all of them
|
||||
for FORMULA in "${FORMULAE[@]}"; do
|
||||
brew outdated $FORMULA || brew upgrade $FORMULA
|
||||
done
|
||||
else
|
||||
brew upgrade
|
||||
brew install boost pkg-config cryptopp openssl
|
||||
fi
|
||||
brew install "${FORMULAE[@]}"
|
||||
brew cleanup
|
||||
fi
|
||||
|
||||
if has Ubuntu $NODE_LABELS; then
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
|
||||
libcrypto++-dev libsqlite3-dev libssl-dev
|
||||
sudo apt-get -qy install build-essential pkg-config libboost-all-dev \
|
||||
libsqlite3-dev libssl-dev
|
||||
fi
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
set -x
|
||||
|
||||
pushd "${CACHE_DIR:-/tmp}" >/dev/null
|
||||
|
||||
INSTALLED_VERSION=
|
||||
if has OSX $NODE_LABELS; then
|
||||
BOOST=$(brew ls --versions boost)
|
||||
OLD_BOOST=$(cat boost.txt || :)
|
||||
if [[ $OLD_BOOST != $BOOST ]]; then
|
||||
echo "$BOOST" > boost.txt
|
||||
INSTALLED_VERSION=NONE
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z $INSTALLED_VERSION ]]; then
|
||||
INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
|
||||
fi
|
||||
|
||||
sudo rm -Rf ndn-cxx-latest
|
||||
|
||||
git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
|
||||
|
||||
LATEST_VERSION=$(git -C ndn-cxx-latest 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 -f /usr/local/bin/ndnsec*
|
||||
sudo rm -fr /usr/local/include/ndn-cxx
|
||||
sudo rm -f /usr/local/lib/libndn-cxx*
|
||||
sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
|
||||
|
||||
pushd ndn-cxx >/dev/null
|
||||
|
||||
./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
|
||||
./waf build --color=yes -j${WAF_JOBS:-1}
|
||||
sudo env "PATH=$PATH" ./waf install --color=yes
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if has Linux $NODE_LABELS; then
|
||||
sudo ldconfig
|
||||
elif has FreeBSD10 $NODE_LABELS; then
|
||||
sudo ldconfig -m
|
||||
fi
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
set -x
|
||||
|
||||
# Cleanup
|
||||
sudo env "PATH=$PATH" ./waf --color=yes distclean
|
||||
|
||||
if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
|
||||
# Configure/build in optimized mode with tests
|
||||
./waf --color=yes configure --with-tests
|
||||
./waf --color=yes build -j${WAF_JOBS:-1}
|
||||
|
||||
# Cleanup
|
||||
sudo env "PATH=$PATH" ./waf --color=yes distclean
|
||||
|
||||
# Configure/build in optimized mode without tests
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes build -j${WAF_JOBS:-1}
|
||||
|
||||
# Cleanup
|
||||
sudo env "PATH=$PATH" ./waf --color=yes distclean
|
||||
fi
|
||||
|
||||
# Configure/build in debug mode with tests and without precompiled headers
|
||||
if [[ $JOB_NAME == *"code-coverage" ]]; then
|
||||
COVERAGE="--with-coverage"
|
||||
elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
|
||||
ASAN="--with-sanitizer=address"
|
||||
fi
|
||||
./waf --color=yes configure --debug --with-tests --without-pch $COVERAGE $ASAN
|
||||
./waf --color=yes build -j${WAF_JOBS:-1}
|
||||
|
||||
# (tests will be run against debug version)
|
||||
|
||||
# Install
|
||||
sudo env "PATH=$PATH" ./waf --color=yes install
|
||||
|
||||
if has Linux $NODE_LABELS; then
|
||||
sudo ldconfig
|
||||
elif has FreeBSD $NODE_LABELS; then
|
||||
sudo ldconfig -a
|
||||
fi
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
set -x
|
||||
|
||||
pushd "${CACHE_DIR:-/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 -j1 --color=yes configure --enable-shared --disable-static --without-osx-keychain
|
||||
./waf -j1 --color=yes build
|
||||
sudo ./waf -j1 --color=yes install
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if has Linux $NODE_LABELS; then
|
||||
sudo ldconfig
|
||||
elif has FreeBSD $NODE_LABELS; then
|
||||
sudo ldconfig -a
|
||||
fi
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
set -x
|
||||
|
||||
git submodule init
|
||||
git submodule sync
|
||||
git submodule update
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
|
||||
if [[ "$JOB_NAME" != *"limited-build" ]]; then
|
||||
# Configure/build in optimized mode with tests
|
||||
./waf -j1 --color=yes configure --with-tests
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
|
||||
# Configure/build in optimized mode without tests
|
||||
./waf -j1 --color=yes configure
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
fi
|
||||
|
||||
# Configure/build in debug mode with tests and without precompiled headers
|
||||
if [[ "$JOB_NAME" == *"code-coverage" ]]; then
|
||||
COVERAGE="--with-coverage"
|
||||
elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
|
||||
ASAN="--with-sanitizer=address"
|
||||
fi
|
||||
./waf -j1 --color=yes configure --debug --with-tests --without-pch $COVERAGE $ASAN
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# (tests will be run against debug version)
|
||||
|
||||
# Install
|
||||
sudo ./waf -j1 --color=yes install
|
||||
|
||||
if has Linux $NODE_LABELS; then
|
||||
sudo ldconfig
|
||||
elif has FreeBSD $NODE_LABELS; then
|
||||
sudo ldconfig -a
|
||||
fi
|
||||
@@ -41,4 +41,5 @@ ASAN_OPTIONS+=":strict_string_checks=true"
|
||||
ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
|
||||
export ASAN_OPTIONS
|
||||
|
||||
./build/unit-tests $(ut_log_args ChronoSync)
|
||||
# Run unit tests
|
||||
./build/unit-tests $(ut_log_args)
|
||||
@@ -0,0 +1,36 @@
|
||||
CONTINUOUS INTEGRATION SCRIPTS
|
||||
==============================
|
||||
|
||||
Environment Variables Used in Build Scripts
|
||||
-------------------------------------------
|
||||
|
||||
- `NODE_LABELS`: the variable defines a list of OS properties. The set values are used by the
|
||||
build scripts to select proper behavior for different OS.
|
||||
|
||||
The list should include at least `[OS_TYPE]`, `[DISTRO_TYPE]`, and `[DISTRO_VERSION]`.
|
||||
|
||||
Possible values for Linux:
|
||||
|
||||
* `[OS_TYPE]`: `Linux`
|
||||
* `[DISTRO_TYPE]`: `Ubuntu`
|
||||
* `[DISTRO_VERSION]`: `Ubuntu-14.04`, `Ubuntu-16.04`
|
||||
|
||||
Possible values for OS X / macOS:
|
||||
|
||||
* `[OS_TYPE]`: `OSX`
|
||||
* `[DISTRO_TYPE]`: `OSX` (can be absent)
|
||||
* `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.11`, `OSX-10.12`
|
||||
|
||||
- `JOB_NAME`: optional variable to define type of the job. Depending on the defined job type,
|
||||
the build scripts can perform different tasks.
|
||||
|
||||
Possible values:
|
||||
|
||||
* empty: default build process
|
||||
* `code-coverage` (Linux OS is assumed): debug build with tests and code coverage analysis
|
||||
* `limited-build`: only a single debug build with tests
|
||||
|
||||
- `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
|
||||
e.g., a compiled version of ndn-cxx library. If not set, `/tmp` is used.
|
||||
|
||||
- `WAF_JOBS`: number of parallel build jobs used by waf, defaults to 1.
|
||||
@@ -1,28 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from waflib import Options, Logs
|
||||
from waflib.Configure import conf
|
||||
|
||||
def addDependencyOptions(self, opt, name, extraHelp=''):
|
||||
opt.add_option('--with-%s' % name, type='string', default=None,
|
||||
dest='with_%s' % name,
|
||||
help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
|
||||
setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
|
||||
|
||||
@conf
|
||||
def checkDependency(self, name, **kw):
|
||||
root = kw.get('path', getattr(Options.options, 'with_%s' % name))
|
||||
kw['msg'] = kw.get('msg', 'Checking for %s library' % name)
|
||||
kw['uselib_store'] = kw.get('uselib_store', name.upper())
|
||||
kw['define_name'] = kw.get('define_name', 'HAVE_%s' % kw['uselib_store'])
|
||||
kw['mandatory'] = kw.get('mandatory', True)
|
||||
|
||||
if root:
|
||||
isOk = self.check_cxx(includes="%s/include" % root,
|
||||
libpath="%s/lib" % root,
|
||||
**kw)
|
||||
else:
|
||||
isOk = self.check_cxx(**kw)
|
||||
|
||||
if isOk:
|
||||
self.env[kw['define_name']] = True
|
||||
@@ -1,42 +1,43 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
VERSION = '0.4.0'
|
||||
APPNAME = 'ChronoSync'
|
||||
GIT_TAG_PREFIX = 'ChronoSync-'
|
||||
|
||||
from waflib import Logs, Utils, Context
|
||||
import os
|
||||
|
||||
VERSION = '0.4.0'
|
||||
APPNAME = 'ChronoSync'
|
||||
|
||||
def options(opt):
|
||||
opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs'])
|
||||
opt.load(['default-compiler-flags', 'boost', 'doxygen', 'sphinx_build',
|
||||
'sanitizers', 'coverage', 'pch'],
|
||||
'coverage', 'sanitizers', 'pch'],
|
||||
tooldir=['.waf-tools'])
|
||||
|
||||
syncopt = opt.add_option_group ("ChronoSync Options")
|
||||
|
||||
syncopt.add_option('--debug', action='store_true', default=False, dest='debug',
|
||||
help='''debugging mode''')
|
||||
syncopt.add_option('--with-tests', action='store_true', default=False, dest='_tests',
|
||||
help='''build unit tests''')
|
||||
opt.add_option('--with-tests', action='store_true', default=False,
|
||||
dest='with_tests', help='''Build unit tests''')
|
||||
|
||||
def configure(conf):
|
||||
conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs',
|
||||
'default-compiler-flags', 'boost', 'pch', 'coverage',
|
||||
'doxygen', 'sphinx_build'])
|
||||
|
||||
if 'PKG_CONFIG_PATH' not in os.environ:
|
||||
os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
|
||||
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
|
||||
uselib_store='NDN_CXX', mandatory=True)
|
||||
|
||||
boost_libs = 'system iostreams thread log log_setup'
|
||||
if conf.options._tests:
|
||||
if conf.options.with_tests:
|
||||
conf.env['CHRONOSYNC_HAVE_TESTS'] = 1
|
||||
conf.define('CHRONOSYNC_HAVE_TESTS', 1);
|
||||
boost_libs += ' unit_test_framework'
|
||||
|
||||
conf.check_boost(lib=boost_libs, mt=True)
|
||||
|
||||
conf.check_compiler_flags()
|
||||
|
||||
# Loading "late" to prevent tests from being compiled with profiling flags
|
||||
conf.load('coverage')
|
||||
|
||||
conf.load('sanitizers')
|
||||
|
||||
# If there happens to be a static library, waf will put the corresponding -L flags
|
||||
@@ -134,7 +135,7 @@ def version(ctx):
|
||||
Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
|
||||
|
||||
try:
|
||||
cmd = ['git', 'describe', '--match', 'ChronoSync-*']
|
||||
cmd = ['git', 'describe', '--match', '%s*' % GIT_TAG_PREFIX]
|
||||
p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
|
||||
stderr=None, stdin=None)
|
||||
out = p.communicate()[0].strip()
|
||||
|
||||
Reference in New Issue
Block a user