From dfef8347e0c31dd4e3583b37e5eb81156c35b08b Mon Sep 17 00:00:00 2001 From: Alfredo Ramos Date: Mon, 4 Jun 2018 09:06:56 -0500 Subject: [PATCH] Travis CI tests improvements (#236) --- .travis.yml | 31 +++---- .travis_linux.sh | 113 -------------------------- .travis_macos.sh | 47 ----------- travis/linux_before_install.sh | 15 ++++ travis/linux_install.sh | 27 +++++++ travis/linux_script.sh | 143 +++++++++++++++++++++++++++++++++ travis/osx_script.sh | 55 +++++++++++++ 7 files changed, 252 insertions(+), 179 deletions(-) delete mode 100644 .travis_linux.sh delete mode 100644 .travis_macos.sh create mode 100755 travis/linux_before_install.sh create mode 100755 travis/linux_install.sh create mode 100755 travis/linux_script.sh create mode 100755 travis/osx_script.sh diff --git a/.travis.yml b/.travis.yml index 076275d1..7e0d28b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ env: - VERSION=0.5.1 - RELEASE=1 - ARCH=x86_64 -# - DOCKER_REPO=packpack/packpack +# - DOCKER_REPO=packpack/packpack - DOCKER_REPO=vitzy/packpack #The actual list of distribution is available on @@ -52,32 +52,25 @@ matrix: # 9 env: OS=debian DIST=stretch EXTEN=deb services: docker - - os: osx - compiler: clang - osx_image: xcode9.2 +# - os: osx +# compiler: clang +# osx_image: xcode9.2 before_install: - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get -qq update ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then travis/linux_before_install.sh; fi before_script: - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then chmod +x .travis_linux.sh ; fi - - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then chmod +x .travis_macos.sh ; fi + - chmod +x travis/*.sh install: - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq git; sudo apt-get install -qq build-essential ; fi - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install openssl libssl-dev ; fi - # - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install libgl1-mesa-dev ; fi - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install tree ; fi - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq gcc-4.9; sudo apt-get install -qq g++-4.9 ; fi - - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq git ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then travis/linux_install.sh; fi script: - # - git submodule update --init --recursive - # - git describe --long - - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then bash ./.travis_linux.sh ; fi - - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then bash ./.travis_macos.sh ; fi - - pwd && ls +# - git submodule update --init --recursive +# - git describe --long + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then travis/linux_script.sh; fi +# - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then travis/osx_script.sh; fi + - pwd && ls # deploy: # # Deploy packages to Github Release diff --git a/.travis_linux.sh b/.travis_linux.sh deleted file mode 100644 index f50f6b52..00000000 --- a/.travis_linux.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -if [[ "${DIST}" != "trusty" ]]; then - git clone https://github.com/packpack/packpack.git packpack ; - mkdir ./dist ; - pwd && ls ; - packpack/packpack ; - if [ $OS == "ubuntu" ]; - then curl --upload-file build/flameshot_*_*.deb "https://transfer.sh/flameshot_$VERSION-$DIST-$ARCH_$ARCH.$EXTEN" ; - # copy deb to dist path for distribution - cp build/flameshot_*_*.deb dist/flameshot_$VERSION-$DIST-$ARCH_$ARCH.$EXTEN ; - elif [ $OS == "debian" ]; - then curl --upload-file build/flameshot_*_*.deb "https://transfer.sh/flameshot_$VERSION-$DIST-$ARCH_$ARCH.$EXTEN" ; - cp build/flameshot_*_*.deb dist/flameshot_$VERSION-$DIST-$ARCH_$ARCH.$EXTEN ; - elif [ $OS == "fedora" ]; - then curl --upload-file build/flameshot-$VERSION-$RELEASE.*.$ARCH.rpm "https://transfer.sh/flameshot_$VERSION-fedora$DIST-$ARCH_$ARCH.$EXTEN" ; - cp build/flameshot-$VERSION-$RELEASE.*.$ARCH.rpm dist/flameshot_$VERSION-fedora$DIST-$ARCH_$ARCH.$EXTEN ; - else echo ""; - fi - echo -e "\n" ; - pwd && ls ; -elif [[ "${DIST}" == "trusty" ]]; then - project_dir=$(pwd) - DIST_PATH='dist' - BUILD_DST_PATH='build-test' - APPIMAGE_DST_PATH='build-appimage' - - # Install qt5.3.2 - sudo add-apt-repository ppa:beineri/opt-qt532-trusty -y - sudo apt-get update -qq - sudo apt-get -y install qt53base qt53tools - source /opt/qt53/bin/qt53-env.sh && qmake --version - export CC=gcc-4.9 CXX=g++-4.9 - - # Install fcitx-frontend-qt5 - sudo apt-get -y install fcitx-frontend-qt5 - - mkdir build-test - qmake QMAKE_CXX=$CXX QMAKE_CC=$CC QMAKE_LINK=$CXX DESTDIR=$BUILD_DST_PATH - # Building flameshot - make -j$(nproc) - # Running flameshot tests - make check -j$(nproc) - ls -alhR - - # - # Packaging AppImage using linuxdeployqt - # - mkdir build-appimage - mkdir -p ./build-appimage/appdir/usr/bin - mkdir -p ./build-appimage/appdir/usr/share/applications - mkdir -p ./build-appimage/appdir/usr/share/dbus-1/interfaces - mkdir -p ./build-appimage/appdir/usr/share/dbus-1/services - mkdir -p ./build-appimage/appdir/usr/share/metainfo - mkdir -p ./build-appimage/appdir/usr/share/bash-completion/completions - mkdir -p ./build-appimage/appdir/usr/share/flameshot/translations - cp $BUILD_DST_PATH/flameshot $APPIMAGE_DST_PATH/appdir/usr/bin - cp ${project_dir}/dbus/org.dharkael.Flameshot.xml $APPIMAGE_DST_PATH/appdir/usr/share/dbus-1/interfaces - cp ${project_dir}/dbus/package/org.dharkael.Flameshot.service $APPIMAGE_DST_PATH/appdir/usr/share/dbus-1/services - cp ${project_dir}/docs/appdata/flameshot.appdata.xml $APPIMAGE_DST_PATH/appdir/usr/share/metainfo - cp ${project_dir}/docs/bash-completion/flameshot $APPIMAGE_DST_PATH/appdir/usr/share/bash-completion/completions - cp ${project_dir}/translations/*.qm $APPIMAGE_DST_PATH/appdir/usr/share/flameshot/translations - cp ${project_dir}/docs/desktopEntry/package/* $APPIMAGE_DST_PATH/appdir/usr/share/applications - cp ${project_dir}/img/flameshot.png $APPIMAGE_DST_PATH/appdir - ls -alhR $APPIMAGE_DST_PATH/appdir - - # Copy other project files - cp "${project_dir}/README.md" "$APPIMAGE_DST_PATH/appdir/README.md" - cp "${project_dir}/LICENSE" "$APPIMAGE_DST_PATH/appdir/LICENSE" - echo ${VERSION} > ./$APPIMAGE_DST_PATH/appdir/version - echo "${TRAVIS_COMMIT}" >> ./$APPIMAGE_DST_PATH/appdir/version - - # Configure env vars - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH - tree $APPIMAGE_DST_PATH/appdir - - # Get linuxdeployqt tool - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt - chmod +x linuxdeployqt - - # Packaging - # -verbose=2 - ./linuxdeployqt $APPIMAGE_DST_PATH/appdir/usr/bin/flameshot -bundle-non-qt-libs - - rm -f $APPIMAGE_DST_PATH/appdir/usr/lib/libatk-1.0.so.0 - cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so $APPIMAGE_DST_PATH/appdir/usr/plugins/platforminputcontexts/ - cd $APPIMAGE_DST_PATH/appdir/usr/bin - ln -sf ../plugins/platforms/ . # An unknown bug - ln -sf ../share/flameshot/translations/ . # add translation soft link - cd ${project_dir} - - # -verbose=2 - ./linuxdeployqt $APPIMAGE_DST_PATH/appdir/usr/share/applications/flameshot.desktop -appimage - - ls -alhR ./*.AppImage - cp *.AppImage $APPIMAGE_DST_PATH/ - - tree $APPIMAGE_DST_PATH/ - - ls -l $APPIMAGE_DST_PATH/*.AppImage - - mkdir dist - - # Rename AppImage and move AppImage to DIST_PATH - cd $APPIMAGE_DST_PATH && mv Flameshot-${VERSION}-${ARCH}.AppImage flameshot_${ARCH}_${VERSION}.AppImage - cd .. && cp $APPIMAGE_DST_PATH/flameshot_${ARCH}_${VERSION}.AppImage $DIST_PATH/flameshot_${ARCH}_${VERSION}.$EXTEN - - pwd - - curl --upload-file $DIST_PATH/flameshot_${ARCH}_${VERSION}.AppImage "https://transfer.sh/flameshot_${ARCH}_${VERSION}.$EXTEN" ; - - exit 0 ; -else echo "" ; -fi diff --git a/.travis_macos.sh b/.travis_macos.sh deleted file mode 100644 index 5ce84f4b..00000000 --- a/.travis_macos.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -project_dir=$(pwd) - -brew update > /dev/null -brew install qt -QTDIR="/usr/local/opt/qt" -PATH="$QTDIR/bin:$PATH" -LDFLAGS=-L$QTDIR/lib -CPPFLAGS=-I$QTDIR/include - -# Build your app -cd ${project_dir} -mkdir dist -mkdir build -cd build -qmake -version -qmake CONFIG-=debug CONFIG+=release CONFIG+=packaging ../flameshot.pro -make -j$(nproc) - -git clone https://github.com/aurelien-rainone/macdeployqtfix.git -pwd && ls - -ls /Users/travis/build/ZetaoYang/flameshot - -# Package DMG from build/flamshot.app directory -$QTDIR/bin/macdeployqt flameshot.app -python ${project_dir}/build/macdeployqtfix/macdeployqtfix.py flameshot.app/Contents/MacOS/flameshot $QTDIR - -cd ${project_dir}/build -mkdir -p distrib/Flameshot -cd distrib/Flameshot -mv ${project_dir}/build/flameshot.app ${project_dir}/build/distrib/Flameshot/ -cp "${project_dir}/LICENSE" "LICENSE" -cp "${project_dir}/README.md" "README.md" -echo ${VERSION} > version -echo "${TRAVIS_COMMIT}" >> version - -ln -s /Applications ./Applications - -cd .. -hdiutil create -srcfolder ./Flameshot -format UDBZ ./flameshot.dmg -mv flameshot.dmg flameshot_X64_$VERSION.dmg -mv flameshot_X64_$VERSION.dmg ${project_dir}/dist/flameshot_X64_$VERSION.dmg -curl --upload-file ./flameshot_X64_$VERSION.dmg "https://transfer.sh/flameshot_X64_$VERSION.dmg" -cd .. - -exit 0 \ No newline at end of file diff --git a/travis/linux_before_install.sh b/travis/linux_before_install.sh new file mode 100755 index 00000000..e8810aec --- /dev/null +++ b/travis/linux_before_install.sh @@ -0,0 +1,15 @@ +#!/bin/bash -- + +set -e + +if [[ "${DIST}" == "trusty" ]]; then + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo add-apt-repository -y ppa:beineri/opt-qt532-trusty + sudo apt-get -qq update + + # Get linuxdeployqt tool + wget \ + -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" \ + -O linuxdeployqt + chmod +x linuxdeployqt +fi diff --git a/travis/linux_install.sh b/travis/linux_install.sh new file mode 100755 index 00000000..1a0d18a0 --- /dev/null +++ b/travis/linux_install.sh @@ -0,0 +1,27 @@ +#!/bin/bash -- + +set -e + +if [[ "${DIST}" == "trusty" ]]; then + sudo apt-get install -qq build-essential git + + sudo -E apt-get -yq \ + --no-install-suggests --no-install-recommends --force-yes \ + install openssl libssl-dev + + #sudo -E apt-get -yq \ + # --no-install-suggests --no-install-recommends --force-yes \ + # install libgl1-mesa-dev + + sudo -E apt-get -yq \ + --no-install-suggests --no-install-recommends --force-yes \ + install tree + + sudo apt-get install -qq gcc-4.9 g++-4.9 + + # Install qt5.3.2 + sudo apt-get -y install qt53base qt53tools + + # Install fcitx-frontend-qt5 + sudo apt-get -y install fcitx-frontend-qt5 +fi diff --git a/travis/linux_script.sh b/travis/linux_script.sh new file mode 100755 index 00000000..f884f3b2 --- /dev/null +++ b/travis/linux_script.sh @@ -0,0 +1,143 @@ +#!/bin/bash -- + +set -e + +if [[ "${DIST}" == "trusty" ]]; then + project_dir="$(pwd)" + DIST_PATH=dist + BUILD_DST_PATH=build-test + APPIMAGE_DST_PATH=build-appimage + + #source /opt/qt53/bin/qt53-env.sh + QT_BASE_DIR=/opt/qt53 + export QTDIR="${QT_BASE_DIR}" + export PATH="${QT_BASE_DIR}"/bin:"${PATH}" + export LD_LIBRARY_PATH="${QT_BASE_DIR}"/lib/x86_64-linux-gnu:"${QT_BASE_DIR}"/lib:"${LD_LIBRARY_PATH}" + export PKG_CONFIG_PATH="${QT_BASE_DIR}"/lib/pkgconfig:"${PKG_CONFIG_PATH}" + + qmake --version + export CC=gcc-4.9 CXX=g++-4.9 + + mkdir build-test + qmake QMAKE_CXX="${CXX}" QMAKE_CC="${CC}" QMAKE_LINK="${CXX}" DESTDIR="${BUILD_DST_PATH}" + # Building flameshot + make -j$(nproc) + # Running flameshot tests + make check -j$(nproc) + ls -alhR + + # + # Packaging AppImage using linuxdeployqt + # + mkdir build-appimage + mkdir -p ./build-appimage/appdir/usr/bin + mkdir -p ./build-appimage/appdir/usr/share/applications + mkdir -p ./build-appimage/appdir/usr/share/dbus-1/interfaces + mkdir -p ./build-appimage/appdir/usr/share/dbus-1/services + mkdir -p ./build-appimage/appdir/usr/share/metainfo + mkdir -p ./build-appimage/appdir/usr/share/bash-completion/completions + mkdir -p ./build-appimage/appdir/usr/share/flameshot/translations + cp \ + "${BUILD_DST_PATH}"/flameshot \ + "${APPIMAGE_DST_PATH}"/appdir/usr/bin + cp \ + "${project_dir}"/dbus/org.dharkael.Flameshot.xml \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/interfaces + cp \ + "${project_dir}"/dbus/package/org.dharkael.Flameshot.service \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/services + cp \ + "${project_dir}"/docs/appdata/flameshot.appdata.xml \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/metainfo + cp \ + "${project_dir}"/docs/bash-completion/flameshot \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/bash-completion/completions + cp \ + "${project_dir}"/translations/*.qm \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/flameshot/translations + cp \ + "${project_dir}"/docs/desktopEntry/package/* \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications + cp \ + "${project_dir}"/img/flameshot.png \ + "${APPIMAGE_DST_PATH}"/appdir + ls -alhR "${APPIMAGE_DST_PATH}"/appdir + + # Copy other project files + cp "${project_dir}"/README.md "${APPIMAGE_DST_PATH}"/appdir/README.md + cp "${project_dir}"/LICENSE "${APPIMAGE_DST_PATH}"/appdir/LICENSE + echo "${VERSION}" > "${APPIMAGE_DST_PATH}"/appdir/version + echo "${TRAVIS_COMMIT}" >> "${APPIMAGE_DST_PATH}"/appdir/version + + # Configure env vars + unset QTDIR + unset QT_PLUGIN_PATH + unset LD_LIBRARY_PATH + tree "${APPIMAGE_DST_PATH}"/appdir + + # Packaging + # -verbose=2 + ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/bin/flameshot -bundle-non-qt-libs + + rm -f "${APPIMAGE_DST_PATH}"/appdir/usr/lib/libatk-1.0.so.0 + cp \ + /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \ + "${APPIMAGE_DST_PATH}"/appdir/usr/plugins/platforminputcontexts/ + cd "${APPIMAGE_DST_PATH}"/appdir/usr/bin + ln -sf ../plugins/platforms/ . # An unknown bug + ln -sf ../share/flameshot/translations/ . # add translation soft link + cd "${project_dir}" + + # -verbose=2 + ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications/flameshot.desktop -appimage + + ls -alhR -- *.AppImage + cp -- *.AppImage "${APPIMAGE_DST_PATH}"/ + + tree "${APPIMAGE_DST_PATH}"/ + + ls -l "${APPIMAGE_DST_PATH}"/*.AppImage + + mkdir dist + + # Rename AppImage and move AppImage to DIST_PATH + cd "${APPIMAGE_DST_PATH}" + mv Flameshot-${VERSION}-${ARCH}.AppImage flameshot_${ARCH}_${VERSION}.AppImage + cd .. + cp \ + "${APPIMAGE_DST_PATH}"/flameshot_${ARCH}_${VERSION}.AppImage \ + "${DIST_PATH}"/flameshot_${ARCH}_${VERSION}.${EXTEN} + pwd + + curl \ + --upload-file "${DIST_PATH}"/flameshot_${ARCH}_${VERSION}.AppImage \ + "https://transfer.sh/flameshot_${ARCH}_${VERSION}.${EXTEN}" +else + git clone https://github.com/packpack/packpack.git + mkdir dist + packpack/packpack + pwd + ls + + case "${OS}" in + "ubuntu"|"debian") + curl \ + --upload-file \ + build/flameshot_*_*.deb \ + "https://transfer.sh/flameshot_${VERSION}-${DIST}-${ARCH}_${ARCH}.${EXTEN}" + # copy deb to dist path for distribution + cp \ + build/flameshot_*_*.deb \ + dist/flameshot_${VERSION}-${DIST}-${ARCH}_${ARCH}.${EXTEN} + ;; + "fedora") + curl \ + --upload-file \ + build/flameshot-${VERSION}-${RELEASE}.*.${ARCH}.rpm \ + "https://transfer.sh/flameshot_${VERSION}-fedora${DIST}-${ARCH}_${ARCH}.${EXTEN}" + cp \ + build/flameshot-${VERSION}-${RELEASE}.*.${ARCH}.rpm \ + dist/flameshot_${VERSION}-fedora${DIST}-${ARCH}_${ARCH}.${EXTEN} + ;; + esac +fi diff --git a/travis/osx_script.sh b/travis/osx_script.sh new file mode 100755 index 00000000..18a3ac3f --- /dev/null +++ b/travis/osx_script.sh @@ -0,0 +1,55 @@ +#!/bin/bash -- + +set -e + +project_dir="$(pwd)" + +brew update > /dev/null +brew install qt +QTDIR=/usr/local/opt/qt +PATH="${QTDIR}"/bin:"${PATH}" +LDFLAGS=-L"${QTDIR}"/lib +CPPFLAGS=-I"${QTDIR}"/include + +# Build your app +cd "${project_dir}" +mkdir dist +mkdir build +cd build +qmake -version +qmake CONFIG-=debug CONFIG+=release CONFIG+=packaging ../flameshot.pro +make -j$(nproc) + +git clone https://github.com/aurelien-rainone/macdeployqtfix.git +pwd +ls + +ls /Users/travis/build/ZetaoYang/flameshot + +# Package DMG from build/flamshot.app directory +"${QTDIR}"/bin/macdeployqt flameshot.app +python \ + "${project_dir}"/build/macdeployqtfix/macdeployqtfix.py \ + flameshot.app/Contents/MacOS/flameshot \ + "${QTDIR}" + +cd "${project_dir}"/build +mkdir -p distrib/Flameshot +cd distrib/Flameshot +mv "${project_dir}"/build/flameshot.app "${project_dir}"/build/distrib/Flameshot/ +cp "${project_dir}"/LICENSE LICENSE +cp "${project_dir}"/README.md README.md +echo "${VERSION}" > version +echo "${TRAVIS_COMMIT}" >> version + +ln -s /Applications ./Applications + +cd .. +hdiutil create -srcfolder ./Flameshot -format UDBZ ./flameshot.dmg +mv flameshot.dmg flameshot_X64_${VERSION}.dmg +mv flameshot_X64_${VERSION}.dmg "${project_dir}"/dist/flameshot_X64_$VERSION.dmg +curl \ + --upload-file \ + flameshot_X64_$VERSION.dmg \ + "https://transfer.sh/flameshot_X64_$VERSION.dmg" +cd ..