ci: update
This commit is contained in:
parent
8528e8ac22
commit
1d20c1222b
@ -1,8 +1,13 @@
|
|||||||
services:
|
image: debian:stable-slim
|
||||||
- docker:dind
|
|
||||||
|
|
||||||
shellcheck:
|
stages:
|
||||||
image: docker:latest
|
- test
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y bash shellcheck
|
||||||
|
|
||||||
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- docker run --rm -v "$(pwd):/mnt" koalaman/shellcheck:stable src/*
|
- bash test.sh
|
||||||
|
31
test.sh
Executable file
31
test.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
exit_result=0
|
||||||
|
files="$(grep -R --exclude-dir='.git' '^#!/.*sh$' 2>/dev/null | cut -d ':' -f 1)"
|
||||||
|
|
||||||
|
|
||||||
|
for file in ${files}
|
||||||
|
do
|
||||||
|
echo "File ${file}... checking"
|
||||||
|
if shellcheck "${file}"
|
||||||
|
then
|
||||||
|
echo " file is correct"
|
||||||
|
else
|
||||||
|
echo " there were errors found in the file"
|
||||||
|
exit_result=1
|
||||||
|
fi
|
||||||
|
echo "Done: ${file}"
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${exit_result} = 0 ]
|
||||||
|
then
|
||||||
|
echo "No errors reported"
|
||||||
|
echo "Exiting successfully"
|
||||||
|
exit ${exit_result}
|
||||||
|
else
|
||||||
|
echo "Some errors reported"
|
||||||
|
echo "Exiting without success"
|
||||||
|
exit ${exit_result}
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user