Skip to content
Permalink
Browse files

Decouple build/install/test scripts from Bamboo

  • Loading branch information...
pb-dseifert committed May 7, 2018
1 parent e953f80 commit 19fbce9ecd41f14cdf98c3f7cb8fa07ad5b48acb
Showing with 72 additions and 59 deletions.
  1. +30 −59 bamboo_build.sh
  2. +21 −0 scripts/ci/build.sh
  3. +13 −0 scripts/ci/install.sh
  4. +8 −0 scripts/ci/test.sh
@@ -1,14 +1,13 @@
#!/usr/bin/env bash
set -vex

echo "################"
echo "# DEPENDENCIES #"
echo "################"
################
# DEPENDENCIES #
################

echo "## Load modules"
## Load modules
type module >& /dev/null || . /mnt/software/Modules/current/init/bash

set +vx
module purge

module load gcc
@@ -20,9 +19,15 @@ module load ninja
module load boost
module load gtest

module load pbbam
case "${bamboo_planRepository_branchName}" in
master)
module load pbbam/master
;;
*)
module load pbbam/develop
;;
esac

set -vx

BOOST_ROOT="${BOOST_ROOT%/include}"
# unset these variables to have meson discover all
@@ -39,77 +44,43 @@ if [[ $USER == bamboo ]]; then
export CCACHE_TEMPDIR=/scratch/bamboo.ccache_tempdir
fi


echo "#########"
echo "# BUILD #"
echo "#########"

case "${bamboo_planRepository_branchName}" in
develop|master)
PREFIX_ARG="/mnt/software/l/libblasr/${bamboo_planRepository_branchName}"
BUILD_NUMBER="${bamboo_globalBuildNumber:-0}"
export PREFIX_ARG="/mnt/software/l/libblasr/${bamboo_planRepository_branchName}"
export BUILD_NUMBER="${bamboo_globalBuildNumber:-0}"
;;
*)
BUILD_NUMBER="0"
export BUILD_NUMBER="0"
;;
esac

# in order to make shared libraries consumable
# by conda and other package managers
default_LDFLAGS="-static-libstdc++ -static-libgcc"
# call the main build+test scripts
export CURRENT_BUILD_DIR="build"
export ENABLED_TESTS="true"

# i : HDF5 major version
for i in "1.10" "1.8"; do
module load hdf5-tools/${i}

CURRENT_BUILD_DIR="build_hdf5=${i}"
mkdir -p "${CURRENT_BUILD_DIR}"/test-reports

echo "=============================="
echo "Current configuration:"
echo " HDF5: ${i}"
echo "=============================="

# 1. configure
# '--wrap-mode nofallback' prevents meson from downloading
# stuff from the internet or using subprojects.
echo "## Configuring source (${CURRENT_BUILD_DIR})"
CPPFLAGS="${HDF5_CFLAGS}" \
LDFLAGS="${default_LDFLAGS} ${HDF5_LIBS}" \
meson \
--wrap-mode nofallback \
--backend ninja \
--buildtype release \
--strip \
--default-library shared \
--libdir lib \
--prefix "${PREFIX_ARG:-/usr/local}" \
-Dtests=true \
"${CURRENT_BUILD_DIR}" .

# 2. build
echo "## Building source (${CURRENT_BUILD_DIR})"
ninja -C "${CURRENT_BUILD_DIR}" -v

# 3. tests
echo "## Tests (${CURRENT_BUILD_DIR})"
GTEST_OUTPUT="xml:${CURRENT_BUILD_DIR}/test-reports/libblasr_results.xml" ARGS=-V VERBOSE=1 \
ninja -C "${CURRENT_BUILD_DIR}" -v test

# TODO(dseifert)
# HDF5 doesn't have pkg-config files yet
export CPPFLAGS="${HDF5_CFLAGS}"
export LDFLAGS="-static-libstdc++ -static-libgcc ${HDF5_LIBS}"

bash scripts/ci/build.sh
bash scripts/ci/test.sh

module unload hdf5-tools
done

# create symlink so Bamboo can find the xunit output
ln -s "${CURRENT_BUILD_DIR}" build

if [[ -z ${PREFIX_ARG+x} ]]; then
echo "Not installing anything (branch: ${bamboo_planRepository_branchName}), exiting."
exit 0
fi

echo "###########"
echo "# INSTALL #"
echo "###########"

echo "## Cleaning out old installation from /mnt/software"
rm -rf "${PREFIX_ARG}"/*

echo "## Installing to /mnt/software"
ninja -C "${CURRENT_BUILD_DIR}" -v install
bash scripts/ci/install.sh
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -vex

#########
# BUILD #
#########

# configure
# '--wrap-mode nofallback' prevents meson from downloading
# stuff from the internet or using subprojects.
meson \
--default-library shared \
--libdir lib \
--unity "${ENABLED_UNITY_BUILD:-off}" \
--wrap-mode nofallback \
--prefix "${PREFIX_ARG:-/usr/local}" \
-Dtests="${ENABLED_TESTS:-false}" \
"${CURRENT_BUILD_DIR:-build}" .

# build
ninja -C "${CURRENT_BUILD_DIR:-build}" -v
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -vex

###########
# INSTALL #
###########

if [[ ${PREFIX_ARG} ]]; then
## Cleaning out old installation from /mnt/software
rm -rf "${PREFIX_ARG}"/*
fi

DESTDIR="${DESTDIR:-/}" ninja -C "${CURRENT_BUILD_DIR:-build}" -v install
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -vex

########
# TEST #
########

ninja -C "${CURRENT_BUILD_DIR:-build}" -v test

0 comments on commit 19fbce9

Please sign in to comment.
You can’t perform that action at this time.