File tree Expand file tree Collapse file tree 5 files changed +34
-5
lines changed
Expand file tree Collapse file tree 5 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 1818 - stage : Test
1919 script : make spellcheck
2020 name : Markdown Spellcheck
21+ - stage : Test
22+ script : make shellcheck
23+ name : Shell Script Check
2124 - stage : Test
2225 script : make homebrew-sync-dry-run
2326 name : Homebrew Sync Dry-Run
Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ go-report-card-test:
6969spellcheck :
7070 ${MAKEFILE_PATH} /test/readme-test/run-readme-spellcheck
7171
72+ shellcheck :
73+ ${MAKEFILE_PATH} /test/shellcheck/run-shellcheck
74+
7275# # requires aws credentials
7376readme-codeblock-test :
7477 ${MAKEFILE_PATH} /test/readme-test/run-readme-codeblocks
@@ -101,8 +104,8 @@ build: compile
101104
102105release : build-binaries build-docker-images push-docker-images upload-resources-to-github
103106
104- test : spellcheck unit-test license-test go-report-card-test output-validation-test readme-codeblock-test
107+ test : spellcheck shellcheck unit-test license-test go-report-card-test output-validation-test readme-codeblock-test
105108
106109help :
107110 @echo $(CURDIR )
108- @grep -E ' ^[a-zA-Z_-]+:.*$$' $(MAKEFILE_LIST ) | sort
111+ @grep -E ' ^[a-zA-Z_-]+:.*$$' $(MAKEFILE_LIST ) | sort
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ trap exit_and_fail INT ERR
1313docker build --target=builder --build-arg=" GOPROXY=direct" -t codeblocks -f $SCRIPTPATH /../../Dockerfile $SCRIPTPATH /../../
1414docker build -t rundoc -f $SCRIPTPATH /rundoc-Dockerfile $SCRIPTPATH /
1515function rd() {
16- docker run -it --rm -v $SCRIPTPATH /../../:/aeis rundoc rundoc $@
16+ docker run -it --rm -v $SCRIPTPATH /../../:/aeis rundoc rundoc " $@ "
1717}
1818
1919rundoc_output=$( rd list-blocks /aeis/README.md)
Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -euo errexit
2+ set -euo pipefail
33
44SCRIPTPATH=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
55
66function exit_and_fail() {
77 echo " ❌ Test Failed! Found a markdown file with spelling errors."
88 exit 1
99}
10- trap exit_and_fail INT ERR
10+ trap exit_and_fail INT ERR TERM
1111
1212docker build -t misspell -f $SCRIPTPATH /spellcheck-Dockerfile $SCRIPTPATH /
1313docker run -i --rm -v $SCRIPTPATH /../../:/aeis misspell /bin/bash -c ' find /aeis/ -type f -name "*.md" -not -path "build" | grep -v "/build/" | xargs misspell -error -debug'
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ SCRIPTPATH=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
6+ BUILD_DIR=" ${SCRIPTPATH} /../../build"
7+
8+ KERNEL=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
9+ SHELLCHECK_VERSION=" 0.7.1"
10+
11+ function exit_and_fail() {
12+ echo " ❌ Test Failed! Found a shell script with errors."
13+ exit 1
14+ }
15+ trap exit_and_fail INT ERR TERM
16+
17+ curl -Lo ${BUILD_DIR} /shellcheck.tar.xz https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION} /shellcheck-v${SHELLCHECK_VERSION} .${KERNEL} .x86_64.tar.xz
18+ tar -C ${BUILD_DIR} -xvf " ${BUILD_DIR} /shellcheck.tar.xz"
19+ export PATH=" ${BUILD_DIR} /shellcheck-v${SHELLCHECK_VERSION} :$PATH "
20+
21+ shellcheck -S error $( grep -Rn -e ' #!.*/bin/bash' -e ' #!.*/usr/bin/env bash' ${SCRIPTPATH} /../../ | grep " :[1-5]:" | cut -d' :' -f1)
22+
23+ echo " ✅ All shell scripts look good! 😎"
You can’t perform that action at this time.
0 commit comments