Skip to content
Snippets Groups Projects
Commit 1f302b82 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Closes #69 and #70

parent 85675d7f
No related branches found
No related tags found
No related merge requests found
...@@ -28,11 +28,10 @@ ssl_verify: false #!final ...@@ -28,11 +28,10 @@ ssl_verify: false #!final
channels: #!final channels: #!final
EOF EOF
if [ -z "${CI_COMMIT_TAG}" ]; then set_conda_channels ${VISIBILITY} ${CI_COMMIT_TAG}
echo " - ${CONDA_BETA_CHANNEL}" >> ${CONDARC} for k in "${CONDA_CHANNELS[@]}"; do
fi echo " - ${DOCSERVER}/${k}" >> ${CONDARC}
echo " - ${CONDA_CHANNEL}" >> ${CONDARC} done
echo " - defaults" >> ${CONDARC}
# displays contents of our configuration # displays contents of our configuration
echo "Contents of \`${CONDARC}':" echo "Contents of \`${CONDARC}':"
......
...@@ -7,24 +7,16 @@ run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh ...@@ -7,24 +7,16 @@ run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh
run_cmd conda activate base run_cmd conda activate base
export_env PATH export_env PATH
run_cmd mkdir -p ./_ci/${OS_SLUG}/${PYTHON_VERSION}
if [ -z "${BOB_BUILD_NUMBER}" ]; then if [ -z "${BOB_BUILD_NUMBER}" ]; then
if [ -z "${CI_COMMIT_TAG}" ]; then set_conda_channels ${VISIBILITY} ${CI_COMMIT_TAG}
run_cmd ${CONDA_ROOT}/bin/python _ci/channel_support.py ${CONDA_BETA_CHANNEL} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION} -u --log ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt set_next_bob_build_number ${CONDA_CHANNELS[0]}
else
run_cmd ${CONDA_ROOT}/bin/python _ci/channel_support.py ${CONDA_CHANNEL} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION} -u --log ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt
fi
BOB_BUILD_NUMBER=`head -n 1 ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt | tr -d '\n'`
export_env BOB_BUILD_NUMBER
fi fi
# copy the recipe_append.yaml over before build # copy the recipe_append.yaml over before build
run_cmd cp ./_ci/recipe_append.yaml conda/recipe_append.yaml run_cmd cp ${SCRIPTS_DIR}/recipe_append.yaml conda/recipe_append.yaml
BLDOPT="--no-anaconda-upload" BLDOPT="--no-anaconda-upload"
BLDOPT="${BLDOPT} --variant-config-files _ci/conda_build_config.yaml" BLDOPT="${BLDOPT} --variant-config-files ${SCRIPTS_DIR}/conda_build_config.yaml"
BLDOPT="${BLDOPT} --python=${PYTHON_VERSION}" BLDOPT="${BLDOPT} --python=${PYTHON_VERSION}"
if [ -n "${BOB_TEST_ONLY}" ]; then if [ -n "${BOB_TEST_ONLY}" ]; then
BLDOPT="${BLDOPT} --test" BLDOPT="${BLDOPT} --test"
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
source $(dirname ${0})/functions.sh source $(dirname ${0})/functions.sh
deploy_conda_packages set_conda_channels ${VISIBILITY} ${CI_COMMIT_TAG}
deploy_conda_packages ${CONDA_CHANNELS[0]} ${CI_PROJECT_NAME}
# upload the docs from the sphinx folder (usually an artifact of Linux Python # upload the docs from the sphinx folder (usually an artifact of Linux Python
# 3.6 builds) # 3.6 builds)
......
...@@ -84,6 +84,19 @@ check_env() { ...@@ -84,6 +84,19 @@ check_env() {
} }
# Checks a given environment variable array is set (non-zero size)
check_array_env() {
if [ -z "${1+abc}" ]; then
log_error "Variable ${1} is undefined - aborting...";
exit 1
else
for i in "${!foo[@]}"; do
log_info "${1}[${i}]=${!1[${i}]}";
done
fi
}
# Exports a given environment variable, verbosely # Exports a given environment variable, verbosely
export_env() { export_env() {
if [ -z "${1+abc}" ]; then if [ -z "${1+abc}" ]; then
...@@ -333,23 +346,56 @@ install_miniconda() { ...@@ -333,23 +346,56 @@ install_miniconda() {
} }
# deployes all conda packages built up to now # deploys all conda packages built up to now
# $1: the channel to upload to
# $2: prefix of the package name to upload (may be empty)
deploy_conda_packages() { deploy_conda_packages() {
# Uploads all the built packages # Uploads all the built packages
for os in "osx-64" "noarch" "linux-64"; do for os in "osx-64" "noarch" "linux-64"; do
for f in ${CONDA_ROOT}/conda-bld/${os}/*.tar.bz2; do for f in ${CONDA_ROOT}/conda-bld/${os}/${2}*.tar.bz2; do
if [[ -f $f ]]; then if [[ -f "${f}" ]]; then
if [ -z "${CI_COMMIT_TAG}" ]; then #beta dav_check_upload "${f}" "${1}/${os}/"
dav_check_upload "${f}" "private-upload/conda/${os}/"
else
dav_check_upload "${f}" "public-upload/conda/label/main/${os}/"
fi
fi fi
done done
done done
} }
# sets BOB_BUILD_NUMBER to the value of the next build number for the package
# with the given specifications
# $1: the channel to lookup
set_next_bob_build_number() {
log_info "$ ${CONDA_ROOT}/bin/python ${SCRIPTS_DIR}/channel_support.py ${DOCSERVER}/${1} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION}"
BOB_BUILD_NUMBER=$(${CONDA_ROOT}/bin/python ${SCRIPTS_DIR}/channel_support.py ${DOCSERVER}/${1} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION})
export_env BOB_BUILD_NUMBER
}
# sets CONDA_CHANNELS to the list of conda channels that should be considered
# $1: visibility (maybe either "public" or "private")
# $2: typically, the value of ${CI_COMMIT_TAG} or empty
# given the current visibility/tagging conditions of the package.
set_conda_channels() {
CONDA_CHANNELS=() #resets bash array
if [ -z "${2}" ]; then
# there are no tags on this build - add beta channels
if [ "${1}" == "private" ]; then
# adds private beta builds (only if the package is also private)
CONDA_CHANNELS+=('private/conda/label/beta')
fi
# adds public stable builds (always)
CONDA_CHANNELS+=('public/conda/label/beta')
fi
if [ "${1}" == "private" ]; then
# adds private stable builds (only if the package is also private)
CONDA_CHANNELS+=('private/conda')
fi
# adds public stable builds (always)
CONDA_CHANNELS+=('public/conda')
check_array_env CONDA_CHANNELS
}
check_env PYTHON_VERSION check_env PYTHON_VERSION
check_env CI_PROJECT_URL check_env CI_PROJECT_URL
check_env CI_PROJECT_DIR check_env CI_PROJECT_DIR
...@@ -373,15 +419,6 @@ check_env IS_MASTER ...@@ -373,15 +419,6 @@ check_env IS_MASTER
if [ -z "${DOCSERVER}" ]; then if [ -z "${DOCSERVER}" ]; then
DOCSERVER=http://www.idiap.ch DOCSERVER=http://www.idiap.ch
export_env DOCSERVER
fi
if [ -z "${CONDA_CHANNEL}" ]; then
CONDA_CHANNEL="${DOCSERVER}/public/conda/label/main"
fi
if [ -z "${CONDA_BETA_CHANNEL}" ]; then
CONDA_BETA_CHANNEL="${DOCSERVER}/private/conda"
fi fi
# Sets up the location of our rc file for conda # Sets up the location of our rc file for conda
...@@ -394,11 +431,9 @@ fi ...@@ -394,11 +431,9 @@ fi
TESTSERVER=https://testpypi.python.org/legacy/ TESTSERVER=https://testpypi.python.org/legacy/
export_env OS_SLUG export_env OS_SLUG
check_env DOCSERVER export_env DOCSERVER
check_env TESTSERVER check_env TESTSERVER
check_env CONDA_ROOT check_env CONDA_ROOT
check_env CONDA_CHANNEL
check_env CONDA_BETA_CHANNEL
export_env CONDARC export_env CONDARC
# Setup default database server # Setup default database server
...@@ -471,5 +506,5 @@ export_env LC_ALL ...@@ -471,5 +506,5 @@ export_env LC_ALL
# Set up the location of matplotlibrc: # Set up the location of matplotlibrc:
# https://matplotlib.org/users/customizing.html#the-matplotlibrc-file # https://matplotlib.org/users/customizing.html#the-matplotlibrc-file
MATPLOTLIBRC="${CI_PROJECT_DIR}/_ci" MATPLOTLIBRC="${SCRIPTS_DIR}"
export_env MATPLOTLIBRC export_env MATPLOTLIBRC
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment