From fc2ee6a747f893a391d82202ea5ca5b3c6d414fb Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Wed, 20 Jun 2018 01:03:52 +0200 Subject: [PATCH] Move build code into separate script --- .travis.yml | 14 +------------- travis/build.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 travis/build.sh diff --git a/.travis.yml b/.travis.yml index 7e992e7..65477d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,19 +22,7 @@ install: - rm -rf patchelf script: - - mkdir build - - cd build - - cmake .. - - make VERBOSE=1 - # deploy patchelf which is a dependency of linuxdeploy - - LINUXDEPLOY_ARGS=("--init-appdir" "--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "../resources/linuxdeploy.png" "--create-desktop-file" "-e" "/usr/bin/patchelf" "-e" "/usr/bin/convert") - - bin/linuxdeploy "${LINUXDEPLOY_ARGS[@]}" - # verify that an AppImage can be built - - wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage - - chmod +x appimagetool-x86_64.AppImage - - ./appimagetool-x86_64.AppImage AppDir - # verify that the resulting AppImage works - - ./linuxdeploy*.AppImage "${LINUXDEPLOY_ARGS[@]}" + - travis/build.sh after_success: - ls -lh diff --git a/travis/build.sh b/travis/build.sh new file mode 100644 index 0000000..d9c7afd --- /dev/null +++ b/travis/build.sh @@ -0,0 +1,47 @@ +#! /bin/bash + +set -e +set -x + +# use RAM disk if possible +if [ "$CI" == "" ] && [ -d /dev/shm ]; then + TEMP_BASE=/dev/shm +else + TEMP_BASE=/tmp +fi + +BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" AppImageUpdate-build-XXXXXX) + +cleanup () { + if [ -d "$BUILD_DIR" ]; then + rm -rf "$BUILD_DIR" + fi +} + +trap cleanup EXIT + +# store repo root as variable +REPO_ROOT=$(readlink -f $(dirname $(dirname $0))) +OLD_CWD=$(readlink -f .) + +pushd "$BUILD_DIR" + +cmake "$REPO_ROOT" + +make VERBOSE=1 + +# args are used more than once +LINUXDEPLOY_ARGS=("--init-appdir" "--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "$REPO_ROOT/resources/linuxdeploy.png" "--create-desktop-file" "-e" "/usr/bin/patchelf") + +# deploy patchelf which is a dependency of linuxdeploy +bin/linuxdeploy "${LINUXDEPLOY_ARGS[@]}" + +# verify that an AppImage can be built +wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage +chmod +x appimagetool-x86_64.AppImage +./appimagetool-x86_64.AppImage AppDir + +# verify that the resulting AppImage works +./linuxdeploy*.AppImage "${LINUXDEPLOY_ARGS[@]}" + +mv linuxdeploy*.AppImage "$OLD_CWD"