From 1b58092a09a99fcb4bcc715b2ca1b0b28f9868dc Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Mon, 12 Mar 2018 18:50:12 +0100 Subject: travis: allow targets to disable deploy --- .travis/deploy.sh | 21 ++++++++++++++++----- .travis/targets/dist-srpm.sh | 4 ++++ .travis/targets/distcheck.sh | 4 ++++ .travis/targets/github-lambda.sh | 4 ++++ .travis/targets/win32.sh | 4 ++++ .travis/targets/win64.sh | 4 ++++ 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index d9ccc0a..c002b35 100755 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -12,11 +12,6 @@ if [[ "x${TRAVIS_BRANCH}" != "xmaster" ]] && [[ "x${TRAVIS_TAG}" != xv* ]]; then exit 0 fi -if [[ "x${CC}" != "xgcc" ]] || [[ "x${TARGET}" = "xvalgrind" ]] || [[ "x${TARGET}" = "xmake-embedded" ]]; then - echo "Invalid target for deploy. skipping ..." - exit 0 -fi - if [[ ! -d build ]]; then echo "Build directory not found." exit 1 @@ -30,6 +25,16 @@ else exit 1 fi +if [[ "x$(type -t deploy)" != "xfunction" ]] || [[ "x$(type -t deploy_condition)" != "xfunction" ]]; then + echo "Nothing to deploy. skipping ..." + exit 1 +fi + +if ! deploy_condition; then + echo "Deploy disabled. skipping ..." + exit 1 +fi + deploy TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)" @@ -67,3 +72,9 @@ for f in "${FILES[@]}"; do echo done + +# this is a hack to allow failed tests to upload files. +# the target must write status code to build/.test_result, instead of exiting directly +if [[ -f build/.test_result ]]; then + exit $(cat build/.test_result) +fi diff --git a/.travis/targets/dist-srpm.sh b/.travis/targets/dist-srpm.sh index 87858c6..732b768 100644 --- a/.travis/targets/dist-srpm.sh +++ b/.travis/targets/dist-srpm.sh @@ -14,6 +14,10 @@ build() { make -C build dist-srpm } +deploy_cond() { + [[ "x${CC}" = "xgcc" ]] +} + deploy() { FILES=( build/*.src.rpm ) } diff --git a/.travis/targets/distcheck.sh b/.travis/targets/distcheck.sh index 104893b..3bf352d 100644 --- a/.travis/targets/distcheck.sh +++ b/.travis/targets/distcheck.sh @@ -13,6 +13,10 @@ build() { make -C build distcheck } +deploy_cond() { + [[ "x${CC}" = "xgcc" ]] +} + deploy() { FILES=( build/*.{*.tar.{gz,bz2,xz},zip} ) } diff --git a/.travis/targets/github-lambda.sh b/.travis/targets/github-lambda.sh index 5eb3422..2a95ca5 100644 --- a/.travis/targets/github-lambda.sh +++ b/.travis/targets/github-lambda.sh @@ -31,6 +31,10 @@ build() { xz -z "build/blogc-static-amd64-${PV}" } +deploy_cond() { + [[ "x${CC}" = "xgcc" ]] +} + deploy() { FILES=( build/*.zip build/blogc-static-*.xz ) } diff --git a/.travis/targets/win32.sh b/.travis/targets/win32.sh index 85a781f..1c64856 100644 --- a/.travis/targets/win32.sh +++ b/.travis/targets/win32.sh @@ -30,6 +30,10 @@ build() { zip "build/${DEST_DIR}.zip" "${DEST_DIR}"/* } +deploy_cond() { + [[ "x${CC}" = "xgcc" ]] +} + deploy() { FILES=( build/*.zip ) } diff --git a/.travis/targets/win64.sh b/.travis/targets/win64.sh index 88fd83c..47d82ee 100644 --- a/.travis/targets/win64.sh +++ b/.travis/targets/win64.sh @@ -30,6 +30,10 @@ build() { zip "build/${DEST_DIR}.zip" "${DEST_DIR}"/* } +deploy_cond() { + [[ "x${CC}" = "xgcc" ]] +} + deploy() { FILES=( build/*.zip ) } -- cgit v1.2.3-18-g5258