gitlab-ci: enable shellcheck on tests/run-tests

This commit is contained in:
Hans-Christoph Steiner 2023-12-13 21:24:16 +01:00
parent 9d8c098f74
commit 865673964e
2 changed files with 15 additions and 6 deletions

View file

@ -215,6 +215,7 @@ lint_format_safety_bandit_checks:
python3-nose python3-nose
python3-pip python3-pip
python3-yaml python3-yaml
shellcheck
- $pip install --break-system-packages bandit safety - $pip install --break-system-packages bandit safety
- export EXITVALUE=0 - export EXITVALUE=0
- function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; } - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
@ -233,6 +234,8 @@ lint_format_safety_bandit_checks:
tests/*.py tests/*.py
tests/*.TestCase tests/*.TestCase
|| set_error || set_error
- shellcheck --exclude SC2046,SC2090 --severity=warning --color tests/run-tests
|| set_error
- exit $EXITVALUE - exit $EXITVALUE

View file

@ -128,30 +128,31 @@ if [ ! -d "$APKDIR" ]; then
exit 1 exit 1
fi fi
if [ -z $WORKSPACE ]; then if [ -z "$WORKSPACE" ]; then
WORKSPACE=`dirname $(pwd)` WORKSPACE="$(dirname "$(pwd)")"
echo "Setting Workspace to $WORKSPACE" echo "Setting Workspace to $WORKSPACE"
fi fi
# allow the location of the script to be overridden # allow the location of the script to be overridden
if [ -z $fdroid ]; then if [ -z "$fdroid" ]; then
fdroid="$WORKSPACE/fdroid" fdroid="$WORKSPACE/fdroid"
fi fi
# allow the location of aapt to be overridden # allow the location of aapt to be overridden
if [ -z $aapt ]; then if [ -z "$aapt" ]; then
aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt 2> /dev/null | sort | tail -1` aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt 2> /dev/null | sort | tail -1`
fi fi
# try to use GNU sed on OSX/BSD cuz BSD sed sucks # try to use GNU sed on OSX/BSD cuz BSD sed sucks
if which gsed; then if which gsed; then
sed=gsed sed="gsed"
else else
sed=sed sed="sed"
fi fi
# allow the location of git to be overridden # allow the location of git to be overridden
if [ -z "$git" ]; then if [ -z "$git" ]; then
# shellcheck disable=SC2089
git="env HOME= GIT_AUTHOR_NAME='Test' GIT_AUTHOR_EMAIL='no@mail' GIT_COMMITTER_NAME='Test' GIT_COMMITTER_EMAIL='no@mail' git" git="env HOME= GIT_AUTHOR_NAME='Test' GIT_AUTHOR_EMAIL='no@mail' GIT_COMMITTER_NAME='Test' GIT_COMMITTER_EMAIL='no@mail' git"
fi fi
@ -740,8 +741,10 @@ if [ -e .git/config ]; then
cd $REPOROOT cd $REPOROOT
tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1` tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1`
cd $REPOROOT cd $REPOROOT
# shellcheck disable=SC2211
./fdroidserver-*/fdroid init ./fdroidserver-*/fdroid init
copy_apks_into_repo $REPOROOT copy_apks_into_repo $REPOROOT
# shellcheck disable=SC2211
./fdroidserver-*/fdroid update --create-metadata --verbose ./fdroidserver-*/fdroid update --create-metadata --verbose
fi fi
@ -1299,13 +1302,16 @@ if which wget; then
http_server_pid=$! http_server_pid=$!
cd $REPOROOT cd $REPOROOT
# shellcheck disable=SC1007
http_proxy= HTTP_PROXY= $fdroid mirror http://127.0.0.1:${port}/ http_proxy= HTTP_PROXY= $fdroid mirror http://127.0.0.1:${port}/
test -e 127.0.0.1\:${port}/repo/souch.smsbypass_9.apk test -e 127.0.0.1\:${port}/repo/souch.smsbypass_9.apk
test -e 127.0.0.1\:${port}/repo/icons-640/souch.smsbypass.9.png test -e 127.0.0.1\:${port}/repo/icons-640/souch.smsbypass.9.png
# the index shouldn't be saved unless it was verified # the index shouldn't be saved unless it was verified
! test -e 127.0.0.1\:${port}/repo/index-v1.jar ! test -e 127.0.0.1\:${port}/repo/index-v1.jar
# shellcheck disable=SC1007
! http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=asdfasdf" ! http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=asdfasdf"
! test -e 127.0.0.1\:${port}/repo/index-v1.jar ! test -e 127.0.0.1\:${port}/repo/index-v1.jar
# shellcheck disable=SC1007
http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=F49AF3F11EFDDF20DFFD70F5E3117B9976674167ADCA280E6B1932A0601B26F6" http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=F49AF3F11EFDDF20DFFD70F5E3117B9976674167ADCA280E6B1932A0601B26F6"
test -e 127.0.0.1\:${port}/repo/index-v1.jar test -e 127.0.0.1\:${port}/repo/index-v1.jar