From 2efe887cad36697bedee423d7c711b1c43ba9135 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 20:30:36 +0300 Subject: [PATCH] Separate script for travis deployment. Check status after each command call. Travis has habit to silent errors in the python script. --- .travis.yml | 13 ++---------- scripts/travis-deploy.sh | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 scripts/travis-deploy.sh diff --git a/.travis.yml b/.travis.yml index eede29a3a..f431a9b85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -136,14 +136,5 @@ notifications: on_success: change on_failure: always after_success: -- | - if [[ "$DEPLOY" == "true" ]]; then - ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; - if [[ "$LEGACY" = false ]]; then - tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.xz"; - else - tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.xz"; - fi - fi +- ../scripts/travis-deploy.sh + diff --git a/scripts/travis-deploy.sh b/scripts/travis-deploy.sh new file mode 100644 index 000000000..39e297c0e --- /dev/null +++ b/scripts/travis-deploy.sh @@ -0,0 +1,43 @@ +print_error() { + echo "[CI] ERROR: $1" +} + + +print_info() { + echo "[CI] INFO: $1" +} + + +check_failure() { + if [ $? -ne 0 ] ; then + if [ -z $1 ] ; then + print_error $1 + else + print_error "Failure exit code is detected." + fi + exit 1 + fi +} + +if [[ "$DEPLOY" == "true" ]]; then + ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; + check_failure "Unable to patch the app bundle."; + + if [[ "$LEGACY" = false ]]; then + legacy_suffix = "" + else + legacy_suffix = "-legacy" + fi + + print_info "Start compressing."; + tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvJf valentina-osx-${TRAVIS_COMMIT}${legacy_suffix}.tar.xz Valentina.app/; + check_failure "Unable to create an archive."; + + print_info "Start uploading."; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}${legacy_suffix}.tar.xz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}${legacy_suffix}.tar.xz"; + check_failure "Unable to upload."; + + print_info "Successfully uploaded."; +else + print_info "No deployment needed."; +fi