2019-07-23 15:37:19 +00:00
|
|
|
---
|
2020-02-10 21:09:31 +00:00
|
|
|
# install moreutils to enable ifne (if not empty)
|
|
|
|
# will only run the respective analyzers when files to test
|
|
|
|
# are acutally found
|
2019-07-23 14:42:56 +00:00
|
|
|
image: fnichol/check-shell:latest
|
|
|
|
|
2019-07-24 08:55:01 +00:00
|
|
|
analyze:
|
2019-07-23 14:42:56 +00:00
|
|
|
stage: test
|
|
|
|
before_script:
|
2020-02-10 21:09:31 +00:00
|
|
|
- apk add moreutils
|
2019-07-23 14:42:56 +00:00
|
|
|
- shellcheck --version
|
|
|
|
script:
|
2019-07-23 14:50:30 +00:00
|
|
|
- echo "--------- CHECKING POSIX SHELLSCRIPTS -------------"
|
2020-02-10 21:09:31 +00:00
|
|
|
- find . -type f -name '*.sh' | ifne xargs shellcheck -Calways
|
2019-07-23 14:50:30 +00:00
|
|
|
- echo "--------- CHECKING ZSH SHELLSCRIPTS -------------"
|
2020-02-10 21:09:31 +00:00
|
|
|
- find . -type f -name '*.zsh' | ifne xargs shellcheck -Calways -s bash -e SC2034
|
2019-07-23 14:42:56 +00:00
|
|
|
|
2019-07-24 08:55:01 +00:00
|
|
|
lint:
|
2019-07-23 14:42:56 +00:00
|
|
|
stage: test
|
|
|
|
before_script:
|
2020-02-10 21:09:31 +00:00
|
|
|
- apk add moreutils
|
2019-07-23 14:42:56 +00:00
|
|
|
- shfmt -version
|
|
|
|
script:
|
2019-07-23 14:50:30 +00:00
|
|
|
- echo "--------- CHECKING POSIX SHELLSCRIPTS -------------"
|
2020-02-10 21:09:31 +00:00
|
|
|
- find . -type f -name '*.sh' | ifne xargs shfmt -d -i 2
|
2019-07-23 14:50:30 +00:00
|
|
|
- echo "--------- CHECKING ZSH SHELLSCRIPTS -------------"
|
2020-02-10 21:09:31 +00:00
|
|
|
- find . -type f -name '*.zsh' | ifne xargs shfmt -d -i 2
|
2019-07-27 11:42:54 +00:00
|
|
|
|
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
image: alpine
|
|
|
|
before_script:
|
|
|
|
- apk add git bash
|
|
|
|
- git clone https://github.com/bats-core/bats-core.git /bats
|
|
|
|
- /bats/bin/bats --version
|
|
|
|
script:
|
|
|
|
- /bats/bin/bats -r .
|