summary refs log tree commit diff
path: root/.ci
diff options
context:
space:
mode:
authorzapashcanon <leo@ndrs.fr>2019-04-24 01:55:05 +0200
committerzapashcanon <leo@ndrs.fr>2019-04-24 01:55:05 +0200
commiteee6f2de31bb01bda96597a5236fc4b2dc668ff4 (patch)
treecdbf798b78024df70262971c6858d1342ea8d019 /.ci
parentUpdate olm repo to new location. (diff)
downloadnheko-eee6f2de31bb01bda96597a5236fc4b2dc668ff4.tar.xz
improve shell scripts and update .gitignore
Diffstat (limited to '.ci')
-rwxr-xr-x.ci/format.sh13
-rwxr-xr-x.ci/install.sh25
-rwxr-xr-x.ci/linux/deploy.sh33
-rwxr-xr-x.ci/macos/deploy.sh35
-rwxr-xr-x.ci/script.sh29
5 files changed, 74 insertions, 61 deletions
diff --git a/.ci/format.sh b/.ci/format.sh
index d87bfb66..d3b629c3 100755
--- a/.ci/format.sh
+++ b/.ci/format.sh
@@ -1,14 +1,15 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
 # Runs the Clang Formatter
 # Return codes:
 #  - 1 there are files to be formatted
 #  - 0 everything looks fine
 
-set -o errexit
-set -o pipefail
-set -o nounset
+set -eu
 
-FILES=`find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \)`
+FILES=$(find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \))
 
-clang-format -i $FILES && git diff --exit-code
+for f in $FILES
+do
+    clang-format -i "$f" && git diff --exit-code
+done;
diff --git a/.ci/install.sh b/.ci/install.sh
index af935a59..8013df41 100755
--- a/.ci/install.sh
+++ b/.ci/install.sh
@@ -1,8 +1,8 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     brew update
     brew install qt5 lmdb clang-format ninja libsodium cmark
     brew upgrade boost cmake icu4c || true
@@ -20,7 +20,7 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then
 fi
 
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
 
     if [ -z "$QT_VERSION" ]; then
         QT_VERSION="592"
@@ -31,19 +31,18 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
     sudo sh cmake-3.12.2-Linux-x86_64.sh  --skip-license  --prefix=/usr/local
 
     mkdir -p build-libsodium
-    pushd build-libsodium
-    curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz
-    tar xfz libsodium-1.0.16.tar.gz 
-    cd libsodium-1.0.16/
-    ./configure && make && make check && sudo make install
-    popd
+    ( cd build-libsodium
+      curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz
+      tar xfz libsodium-1.0.16.tar.gz
+      cd libsodium-1.0.16/
+      ./configure && make && make check && sudo make install )
 
     sudo add-apt-repository -y ppa:beineri/opt-qt${QT_VERSION}-trusty
-    sudo apt-get update -qq
-    sudo apt-get install -qq -y \
+    sudo apt update -qq
+    sudo apt install -qq -y \
         qt${QT_PKG}base \
         qt${QT_PKG}tools \
         qt${QT_PKG}svg \
         qt${QT_PKG}multimedia \
         liblmdb-dev
-fi
\ No newline at end of file
+fi
diff --git a/.ci/linux/deploy.sh b/.ci/linux/deploy.sh
index 0fd23808..b8c1c5e3 100755
--- a/.ci/linux/deploy.sh
+++ b/.ci/linux/deploy.sh
@@ -1,13 +1,17 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
 APP=nheko
 DIR=${APP}.AppDir
-TAG=`git tag -l --points-at HEAD`
+# unused but may be useful...
+#TAG=$(git tag -l --points-at HEAD)
 
 # Set up AppImage structure.
-mkdir -p ${DIR}/usr/{bin,lib,share/pixmaps,share/applications}
+for d in bin lib share/pixmaps share/applications
+do
+    mkdir -p ${DIR}/usr/$d
+done
 
 # Copy resources.
 cp build/nheko ${DIR}/usr/bin
@@ -27,19 +31,26 @@ fi
 chmod a+x linuxdeployqt*.AppImage
 
 unset QTDIR
-unset QT_PLUGIN_PATH 
+unset QT_PLUGIN_PATH
 unset LD_LIBRARY_PATH
 
-export ARCH=$(uname -m)
-export LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
+ARCH=$(uname -m)
+export ARCH
+LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+
+for res in ./linuxdeployqt*.AppImage
+do
+    linuxdeployqt=$res
+done
 
-./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs
-./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage
+./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs
+./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage
 
 chmod +x nheko-*x86_64.AppImage
 
-if [ ! -z $VERSION ]; then
+if [ ! -z "$VERSION" ]; then
     # commented out for now, as AppImage file appears to already contain the version.
     #mv nheko-*x86_64.AppImage nheko-${VERSION}-x86_64.AppImage
     echo "nheko-${VERSION}-x86_64.AppImage"
-fi
\ No newline at end of file
+fi
diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh
index 79701243..45ed13bc 100755
--- a/.ci/macos/deploy.sh
+++ b/.ci/macos/deploy.sh
@@ -1,29 +1,30 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-TAG=`git tag -l --points-at HEAD`
+# unused
+#TAG=$(git tag -l --points-at HEAD)
 
 # Add Qt binaries to path
 PATH=/usr/local/opt/qt/bin/:${PATH}
 
-pushd build
+( cd build
+  # macdeployqt does not copy symlinks over.
+  # this specifically addresses icu4c issues but nothing else.
+  ICU_LIB="$(brew --prefix icu4c)/lib"
+  export ICU_LIB
+  mkdir -p nheko.app/Contents/Frameworks
+  find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
 
-# macdeployqt does not copy symlinks over.
-# this specifically addresses icu4c issues but nothing else.
-export ICU_LIB="$(brew --prefix icu4c)/lib"
-mkdir -p nheko.app/Contents/Frameworks
-find ${ICU_LIB} -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
+  sudo macdeployqt nheko.app -dmg -always-overwrite
 
-sudo macdeployqt nheko.app -dmg -always-overwrite
-
-user=$(id -nu)
-sudo chown ${user} nheko.dmg
-mv nheko.dmg ..
-popd
+  user=$(id -nu)
+  sudo chown "${user}" nheko.dmg
+  mv nheko.dmg ..
+)
 
 dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg
 
-if [ ! -z $VERSION ]; then
-    mv nheko.dmg nheko-${VERSION}.dmg
+if [ ! -z "$VERSION" ]; then
+    mv nheko.dmg "nheko-${VERSION}.dmg"
 fi
diff --git a/.ci/script.sh b/.ci/script.sh
index 435f2c27..2d5cc49b 100755
--- a/.ci/script.sh
+++ b/.ci/script.sh
@@ -1,31 +1,32 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
-set -ex
+set -eux
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
     export CC=${C_COMPILER}
     export CXX=${CXX_COMPILER}
 
-    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${C_COMPILER} 10
-    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/${CXX_COMPILER} 10
+    sudo update-alternatives --install /usr/bin/gcc gcc "/usr/bin/${C_COMPILER}" 10
+    sudo update-alternatives --install /usr/bin/g++ g++ "/usr/bin/${CXX_COMPILER}" 10
 
     sudo update-alternatives --set gcc "/usr/bin/${C_COMPILER}"
     sudo update-alternatives --set g++ "/usr/bin/${CXX_COMPILER}"
 fi
 
-if [ "$TRAVIS_OS_NAME" == "linux" ]; then
-    source /opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh || true;
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+    # shellcheck disable=SC1090
+    . "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || true;
 fi
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
 fi
 
 # Build & install dependencies
 cmake -GNinja -Hdeps -B.deps \
-    -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \
-    -DUSE_BUNDLED_CMARK=${USE_BUNDLED_CMARK} \
-    -DUSE_BUNDLED_JSON=${USE_BUNDLED_JSON}
+    -DUSE_BUNDLED_BOOST="${USE_BUNDLED_BOOST}" \
+    -DUSE_BUNDLED_CMARK="${USE_BUNDLED_CMARK}" \
+    -DUSE_BUNDLED_JSON="${USE_BUNDLED_JSON}"
 cmake --build .deps
 
 # Build nheko
@@ -34,14 +35,14 @@ cmake -GNinja -H. -Bbuild \
     -DCMAKE_INSTALL_PREFIX=.deps/usr
 cmake --build build
 
-if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
     make lint;
 
-    if [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ] ; then
+    if [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ] ; then
         make macos-deploy;
     fi
 fi
 
-if [ "$TRAVIS_OS_NAME" == "linux" ] && [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ]; then
+if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ]; then
     make linux-deploy;
 fi