From c19adef3132c2d0675098213f4f91689b2e18913 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.anjos@idiap.ch> Date: Thu, 22 Sep 2016 15:58:16 +0200 Subject: [PATCH] Minor improvements to new CI infrastructure --- ci/pypi.sh | 73 ------------------------------------------ gitlab/after_deploy.sh | 2 +- gitlab/deploy.sh | 3 -- gitlab/functions.sh | 14 ++------ 4 files changed, 3 insertions(+), 89 deletions(-) delete mode 100755 ci/pypi.sh diff --git a/ci/pypi.sh b/ci/pypi.sh deleted file mode 100755 index 1695f9a..0000000 --- a/ci/pypi.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash -# Wed 21 Sep 2016 13:08:05 CEST - -# Functions for coloring echo commands -red_echo() { - echo -e "\033[1;31m${@}\033[0m" -} - -green_echo() { - echo -e "\033[1;32m${@}\033[0m" -} - -if [ -z "${PYPIUSER}" ] || [ -z "${PYPIPASS}" ]; then - red_echo "PYPIUSER and/or PYPIPASS undefined - aborting..."; - exit 1 -fi - -if [ -z "${CI_BUILD_TAG}" ]; then - red_echo "CI_BUILD_TAG undefined - can only work with tags, aborting..."; - exit 1 -fi - -PYPISERVER=`[ -z "${PYPISERVER}" ] || https://pypi.python.org` -TESTSERVER=https://testpypi.python.org - -cat <<EOT >> ~/.pypirc -[distutils] -index-servers = - production - staging - -[production] -repository: ${PYPISERVER} -username: ${PYPIUSER} -password: ${PYPIPASS} - -[staging] -repository: https://testpypi.python.org/ -username: ${PYPIUSER} -password: ${PYPIPASS} -EOT -chmod 600 ~/.pypirc - -setup() { - local cmd=python setup.py "${@}" - green_echo "[>>] Running ${cmd}..." - local status=$? - if [ ${status} != 0 ]; then - red_echo "Command \"${cmd}\" failed - aborting..." - rm -f ~/.pypirc - exit ${status} - fi -} - -green_echo "[>>] Uploading first to ${TESTSERVER} on behalf of ${PYPIUSER}..." -setup check sdist --formats zip upload --repository staging -green_echo "[<<] Test finished, proceeding..." - -# if that worked, uploads documentation to pythonhosted if any exists -if [ -d doc ]; then - green_echo "[>>] Uploading documentation on behalf of ${PYPIUSER}..." - setup upload_docs --upload-dir sphinx - green_echo "[<<] Documentation uploaded, proceeding..." -fi - -# if that worked, uploads source package to the production index -green_echo "[>>] Uploading package to ${PYPISERVER} on behalf of ${PYPIUSER}..." -setup check sdist --formats zip upload --repository production -green_echo "[<<] Package deployed, goodbye." - -# cleanup -rm -f ~/.pypirc -exit 0 diff --git a/gitlab/after_deploy.sh b/gitlab/after_deploy.sh index d161c1f..ac195c7 100755 --- a/gitlab/after_deploy.sh +++ b/gitlab/after_deploy.sh @@ -3,6 +3,6 @@ source $(dirname ${0})/functions.sh +run_cmd rm -rf ~/.pypirc check_env CONDA_PREFIX run_cmd rm -rf ${CONDA_PREFIX} -run_cmd rm -rf ~/.pypirc diff --git a/gitlab/deploy.sh b/gitlab/deploy.sh index ef0bed7..3703b66 100755 --- a/gitlab/deploy.sh +++ b/gitlab/deploy.sh @@ -25,6 +25,3 @@ fi # if that worked, uploads source package to the production index log_info "Uploading package to ${PYPISERVER} on behalf of ${PYPIUSER}..." setup check sdist --formats zip upload --repository production - -# cleanup -run_cmd rm -f ~/.pypirc diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 8fad3fa..a5c46d1 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -52,18 +52,8 @@ run_cmd() { # Runs setup.py setup() { - check_env CONDA_PREFIX - local python=`pwd`/${CONDA_PREFIX}/bin/python - log_info "Running \"${@}\"..." - ${python} setup.py ${@} - local status=$? - if [ ${status} != 0 ]; then - log_error "Command Failed \"${python} setup.py ${@}\"" - log_info rm -f ~/.pypirc - exit ${status} - else - log_info "Finished comand \"${python} setup.py ${@}\"" - fi + check_env PREFIX + run_cmd ${PREFIX}/bin/python setup.py ${@} } -- GitLab