Skip to content
43 changes: 38 additions & 5 deletions scripts/jenkins-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
# - it detects the branch under which the CCPi is build, master is uploaded to anaconda channel, non-master branch isn't
# NO_GPU - if set to true, GPU driver information is not printed
# RECIPE_PATH - if set, uses this as the path to the conda recipe instead of Wrappers/Python/conda-recipe
# TEST_PY - Can be set to a bash array of versions to test if not tag i.e (3.8 3.8 3.10 3.10)
# TEST_NP - Can be set to a bash array of versions to test if not tag i.e (1.21 1.23 1.21 1.23)

echo CCPi build
echo called with arguments: $@
echo CCPI_BUILD_ARGS: $CCPI_BUILD_ARGS
Expand All @@ -36,7 +39,8 @@ if [[ -z ${NO_GPU} ]] || [ ${NO_GPU} = false ]; then
nvidia-smi
fi

if [[ -z ${RECIPE_PATH} ]] ; then

if [[ ! -n ${RECIPE_PATH} ]] ; then
export RECIPE_PATH=Wrappers/Python/conda-recipe
fi

Expand Down Expand Up @@ -83,6 +87,18 @@ cat .git/HEAD

conda install -y conda-build


# set test Python and NumPy version
TEST_ALL=true

if [[ ${ncommits} != "0" ]]; then

if [[ -n ${TEST_PY} && -n ${TEST_NP} ]]; then
TEST_ALL=false
fi

fi

#This may be removed in future
if [[ -n ${CCPI_PRE_BUILD} ]]; then
eval conda build "${CCPI_PRE_BUILD}"
Expand All @@ -92,14 +108,31 @@ else
fi
# need to call first build

if [[ -d ${RECIPE_PATH} ]]; then
eval conda build ${RECIPE_PATH} "$CCPI_BUILD_ARGS" "$@"
fi

# set path to recipe if recipe exists
if [[ -d recipe ]]; then
eval conda build recipe "$CCPI_BUILD_ARGS" "$@"
RECIPE_PATH=recipe
fi

if [[ ${TEST_ALL} == true ]]; then
# build and test all
eval conda build ${RECIPE_PATH} "$CCPI_BUILD_ARGS" "$@"
else
# first build all
eval conda build --no-test ${RECIPE_PATH} "$CCPI_BUILD_ARGS" "$@"
#then build some with tests
for i in ${!TEST_PY[@]};
do
py_ver=${TEST_PY[$i]}
np_ver=${TEST_NP[$i]}
eval conda build ${RECIPE_PATH} "$CCPI_BUILD_ARGS" "$@" --python=${py_ver} --numpy=${np_ver}
done
fi

# get list of created files
export REG_FILES=`ls /home/jenkins/conda-bld/linux-64/*${CIL_VERSION}*${ncommits}.tar.bz2`


if ls /home/jenkins/conda-bld/linux-64/*${CIL_TAG_PREV}*.tar.bz2 1> /dev/null 2>&1; then
export REG_FILES=`ls /home/jenkins/conda-bld/linux-64/*${CIL_TAG_PREV}*.tar.bz2`
elif ls /home/jenkins/conda-bld/noarch/*${CIL_TAG_PREV}*.tar.bz2 1> /dev/null 2>&1; then
Expand Down