ci/lint: Fix lint-shell.sh in CI (#4489)

* lint: Skip shell linting if gawk is not installed

* lint: Skip Gitian descriptor scripts checking if jq is not installed

* ci: Install gawk and jq

`yq` requires `jq`

* Fix shellcheck warnings
This commit is contained in:
UdjinM6 2021-10-11 00:41:20 +03:00 committed by GitHub
parent 35ed2b08c1
commit 77b2cfc374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 4 deletions

View File

@ -40,7 +40,7 @@ RUN apt-get update && apt-get install $APT_ARGS g++-arm-linux-gnueabihf && rm -r
RUN apt-get update && apt-get install $APT_ARGS g++-mingw-w64-x86-64 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS g++-mingw-w64-x86-64 && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install $APT_ARGS wine-stable wine32 wine64 bc nsis xorriso && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS wine-stable wine32 wine64 bc nsis xorriso && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install $APT_ARGS python3-zmq && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS python3-zmq && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install $APT_ARGS cppcheck && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS cppcheck gawk jq && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install $APT_ARGS imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install $APT_ARGS imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools && rm -rf /var/lib/apt/lists/*
ARG SHELLCHECK_VERSION=v0.7.1 ARG SHELLCHECK_VERSION=v0.7.1

View File

@ -180,7 +180,7 @@ script: |
find . -name "lib*.la" -delete find . -name "lib*.la" -delete
find . -name "lib*.a" -delete find . -name "lib*.a" -delete
rm -rf ${DISTNAME}/lib/pkgconfig rm -rf ${DISTNAME}/lib/pkgconfig
find .. -name *.dSYM -exec cp -ra {} ${DISTNAME}/bin \; find .. -name "*.dSYM" -exec cp -ra {} ${DISTNAME}/bin \;
find ${DISTNAME} -not -path '*.dSYM*' | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz find ${DISTNAME} -not -path '*.dSYM*' | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz
find ${DISTNAME} -path '*.dSYM*' | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz find ${DISTNAME} -path '*.dSYM*' | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz
cd ../../ cd ../../

View File

@ -180,7 +180,7 @@ script: |
make ${MAKEOPTS} -C src check-security make ${MAKEOPTS} -C src check-security
make deploy make deploy
make install DESTDIR=${INSTALLPATH} make install DESTDIR=${INSTALLPATH}
rename 's/-setup\.exe$/-setup-unsigned.exe/' *-setup.exe rename 's/-setup\.exe$/-setup-unsigned.exe/' "*-setup.exe"
cp -f dashcore-*setup*.exe $OUTDIR/ cp -f dashcore-*setup*.exe $OUTDIR/
cd installed cd installed
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/ mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/

View File

@ -47,7 +47,7 @@ if test -n "@debug@" && test -z "@no_qt@" && test "x$with_gui" != xno; then
with_gui=qt5_debug with_gui=qt5_debug
fi fi
if test x@host_os@ = xdarwin; then if test "@host_os@" = darwin; then
BREW=no BREW=no
PORT=no PORT=no
fi fi

View File

@ -50,6 +50,11 @@ if ! command -v shellcheck > /dev/null; then
exit $EXIT_CODE exit $EXIT_CODE
fi fi
if ! command -v gawk > /dev/null; then
echo "Skipping shell linting since gawk is not installed."
exit $EXIT_CODE
fi
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")" EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files
if ! shellcheck "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then if ! shellcheck "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
@ -61,6 +66,11 @@ if ! command -v yq > /dev/null; then
exit $EXIT_CODE exit $EXIT_CODE
fi fi
if ! command -v jq > /dev/null; then
echo "Skipping Gitian descriptor scripts checking since jq is not installed."
exit $EXIT_CODE
fi
EXCLUDE_GITIAN=${EXCLUDE}",$(IFS=','; echo "${disabled_gitian[*]}")" EXCLUDE_GITIAN=${EXCLUDE}",$(IFS=','; echo "${disabled_gitian[*]}")"
for descriptor in $(git ls-files -- 'contrib/gitian-descriptors/*.yml') for descriptor in $(git ls-files -- 'contrib/gitian-descriptors/*.yml')
do do