From 73aba586d4a9ea1aa665761abaf67e2515cef801 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 25 Dec 2019 08:41:53 -0600 Subject: [PATCH] move eslint into env matrix + other build tweaks --- .travis.yml | 7 +------ utils/packpack/rsync_xfer.sh | 12 +++++++---- utils/packpack/startpackpack.sh | 36 ++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index bbcc97fac..f6c2dea02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ env: - SMPFLAGS=-j4 OS=debian DIST=buster ARCH=i386 - SMPFLAGS=-j4 OS=debian DIST=stretch ARCH=i386 - SMPFLAGS=-j4 OS=raspbian DIST=stretch ARCH=armhf DOCKER_REPO=knnniggett/packpack + - SMPFLAGS=-j4 OS=eslint DIST=eslint compiler: - gcc @@ -58,12 +59,6 @@ services: - mysql - docker -jobs: - include: - - name: eslint - install: npm install -g eslint@5.12.0 eslint-config-google@0.11.0 eslint-plugin-html@5.0.0 eslint-plugin-php-markup@0.2.5 - script: eslint --ext .php,.js . - script: - utils/packpack/startpackpack.sh diff --git a/utils/packpack/rsync_xfer.sh b/utils/packpack/rsync_xfer.sh index 1b3d81204..af3dba54f 100755 --- a/utils/packpack/rsync_xfer.sh +++ b/utils/packpack/rsync_xfer.sh @@ -1,5 +1,10 @@ #!/bin/bash +# We don't deploy during eslint checks, so exit immediately +if [ "${DIST}" == "eslint" ]; then + exit 0 +fi + # Check to see if this script has access to all the commands it needs for CMD in sshfs rsync find fusermount mkdir; do type $CMD 2>&1 > /dev/null @@ -29,16 +34,15 @@ if [ "${TRAVIS_EVENT_TYPE}" == "cron" ] || [ "${OS}" == "debian" ] || [ "${OS}" echo echo "Running \$(rsync -v -e 'ssh -vvv' build/* zmrepo@zmrepo.zoneminder.com:${targetfolder}/ 2>&1)" - rsync -v -e 'ssh -vvv' build/* zmrepo@zmrepo.zoneminder.com:${targetfolder}/ 2>&1 - result="$?" - if [ "$result" -eq 0 ]; then + rsync -v --ignore-missing-args -e 'ssh -vvv' build/*.{rpm,deb,dsc,tar.xz,changes} zmrepo@zmrepo.zoneminder.com:${targetfolder}/ 2>&1 + if [ "$?" -eq 0 ]; then echo echo "Files copied successfully." echo else echo echo "ERROR: Attempt to rsync to zmrepo.zoneminder.com failed!" - echo "The following error code was returned: $result." + echo "See log output for details." echo exit 99 fi diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 35a6aeab4..72519f115 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -150,7 +150,7 @@ install_deb () { exit 1 fi - # Install and test the zoneminder package (only) for Ubuntu Trusty + # Install and test the zoneminder package (only) for Ubuntu Xenial pkgname="build/zoneminder_${VERSION}-${RELEASE}_amd64.deb" if [ -e $pkgname ]; then @@ -276,6 +276,8 @@ checkdeploytarget () { echo traceroute -w 2 -m 15 ${DEPLOYTARGET} fi + + exit 97 } ################ @@ -326,8 +328,9 @@ if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then echo "Starting packpack..." execpackpack - fi; - # Steps common to Debian based distros + fi + +# Steps common to Debian based distros elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ] || [ "${OS}" == "raspbian" ]; then commonprep echo "Begin ${OS} ${DIST} build..." @@ -348,14 +351,27 @@ elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ] || [ "${OS}" == "raspbia echo "Starting packpack..." execpackpack - # We were not triggered via cron so just build and test trusty - if [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "xenial" ] && [ "${ARCH}" == "x86_64" ]; then - # If we are running inside Travis then attempt to install the deb we just built - if [ "${TRAVIS}" == "true" ]; then + # Try to install and run the newly built zoneminder package + if [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "xenial" ] && [ "${ARCH}" == "x86_64" ] && [ "${TRAVIS}" == "true" ]; then + echo "Begin Deb package installation..." install_deb - fi fi + +# Steps common to eslint checks +elif [ "${OS}" == "eslint" ] || [ "${DIST}" == "eslint" ]; then + + # Check we've got npm installed + type npm 2>&1 > /dev/null + + if [ $? -ne 0 ]; then + echo + echo "ERROR: The script cannot find the required command \"npm\"." + echo + exit 1 + fi + + npm install -g eslint@5.12.0 eslint-config-google@0.11.0 eslint-plugin-html@5.0.0 eslint-plugin-php-markup@0.2.5 + echo "Begin eslint checks..." + eslint --ext .php,.js . fi -exit 0 -