ci: sync CI scripts with NFD
Notable changes include:
- support WAF_JOBS env var
- use two parallel build jobs on Travis-CI
- use "limited builds" for code-coverage and Travis-CI
- upgrade Travis-CI osx from xcode8.2 to xcode8.3
- enable ASan on Travis-CI
Change-Id: I4101499ebc590478d67ec8134c0395c4aafb8fb6
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
similarity index 81%
rename from .jenkins.d/10-ndn-cxx.sh
rename to .jenkins.d/01-ndn-cxx.sh
index 9f8a9b2..6eb84a5 100755
--- a/.jenkins.d/10-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -6,7 +6,7 @@
set -x
-pushd /tmp >/dev/null
+pushd "${CACHE_DIR:-/tmp}" >/dev/null
INSTALLED_VERSION=
if has OSX $NODE_LABELS; then
@@ -20,7 +20,7 @@
## Uncomment when #3920 and #4119 merge.
# if [[ -z $INSTALLED_VERSION ]]; then
-# INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
+# INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
# fi
sudo rm -Rf ndn-cxx-latest
@@ -28,9 +28,8 @@
sudo rm -Rf ndn-cxx-hotfix
git clone git://github.com/named-data/ndn-cxx ndn-cxx-hotfix
-
## Uncomment when #3920 and #4119 merge.
-# LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+# 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
@@ -51,8 +50,8 @@
pushd ndn-cxx-hotfix >/dev/null
git checkout b555b00c280b9c9ed46f24a1fbebc73b720601af
-./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
-./waf -j1 --color=yes
+./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
diff --git a/.jenkins.d/11-chronosync.sh b/.jenkins.d/02-chronosync.sh
similarity index 81%
rename from .jenkins.d/11-chronosync.sh
rename to .jenkins.d/02-chronosync.sh
index 3d87d4a..aa8c875 100755
--- a/.jenkins.d/11-chronosync.sh
+++ b/.jenkins.d/02-chronosync.sh
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
-set -x
set -e
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "$JDIR"/util.sh
-pushd /tmp >/dev/null
+set -x
+
+pushd "${CACHE_DIR:-/tmp}" >/dev/null
INSTALLED_VERSION=
if has OSX $NODE_LABELS; then
@@ -18,7 +19,7 @@
fi
# if [[ -z $INSTALLED_VERSION ]]; then
-# INSTALLED_VERSION=$((cd ChronoSync && git rev-parse HEAD) 2>/dev/null || echo NONE)
+# INSTALLED_VERSION=$(git -C ChronoSync rev-parse HEAD 2>/dev/null || echo NONE)
# fi
sudo rm -Rf ChronoSync-latest
@@ -26,7 +27,7 @@
sudo rm -rf ChronoSync-hotfix
git clone git://github.com/named-data/ChronoSync ChronoSync-hotfix
-# LATEST_VERSION=$((cd ChronoSync-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
+# LATEST_VERSION=$(git -C ChronoSync-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
# if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
# sudo rm -Rf ChronoSync
@@ -46,8 +47,8 @@
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
fi
-./waf -j1 --color=yes configure
-./waf -j1 --color=yes build
+./waf configure --color=yes
+./waf build --color=yes -j${WAF_JOBS:-1}
sudo env "PATH=$PATH" ./waf install --color=yes
popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..358251d
--- /dev/null
+++ b/.jenkins.d/10-build.sh
@@ -0,0 +1,44 @@
+#!/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 env "PATH=$PATH" ./waf --color=yes distclean
+
+if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
+ # Configure/build in debug mode with tests
+ ./waf --color=yes configure --with-tests --debug
+ ./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 optimized mode with tests
+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 --with-tests $COVERAGE $ASAN
+./waf --color=yes build -j${WAF_JOBS:-1}
+
+# (tests will be run against optimized version)
+
+# Install
+sudo env "PATH=$PATH" ./waf --color=yes install
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
deleted file mode 100755
index a3c171e..0000000
--- a/.jenkins.d/20-build.sh
+++ /dev/null
@@ -1,43 +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 env "PATH=$PATH" ./waf --color=yes distclean
-
-# Configure/build in debug mode
-./waf -j1 --color=yes configure --with-tests --debug
-./waf -j1 --color=yes build
-
-# Cleanup
-sudo env "PATH=$PATH" ./waf --color=yes distclean
-
-# Configure/build in optimized mode without tests
-./waf -j1 --color=yes configure
-./waf -j1 --color=yes build
-
-# Cleanup
-sudo env "PATH=$PATH" ./waf --color=yes distclean
-
-if [[ $JOB_NAME == *"code-coverage" ]]; then
- COVERAGE="--with-coverage"
-elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
- ASAN="--with-sanitizer=address"
-fi
-
-# Configure/build in optimized mode with tests
-./waf -j1 --color=yes configure --with-tests $COVERAGE $ASAN
-./waf -j1 --color=yes build
-
-# (tests will be run against optimized version)
-
-# Install
-sudo env "PATH=$PATH" ./waf --color=yes install
diff --git a/.jenkins.d/30-tests.sh b/.jenkins.d/20-tests.sh
similarity index 76%
rename from .jenkins.d/30-tests.sh
rename to .jenkins.d/20-tests.sh
index 6be5a4a..b172b2a 100755
--- a/.jenkins.d/30-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -1,9 +1,14 @@
#!/usr/bin/env bash
-set -x
set -e
+set -x
+# Prepare environment
rm -Rf ~/.ndn
+ut_log_args() {
+ echo --log_level=test_suite
+}
+
ASAN_OPTIONS="color=always"
ASAN_OPTIONS+=":detect_stack_use_after_return=true"
ASAN_OPTIONS+=":check_initialization_order=true"
@@ -14,4 +19,5 @@
ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
export ASAN_OPTIONS
-./build/unit-tests-nlsr -l test_suite
+# Run unit tests
+./build/unit-tests-nlsr $(ut_log_args)
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
new file mode 100644
index 0000000..41812aa
--- /dev/null
+++ b/.jenkins.d/README.md
@@ -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.