Travis testing

This commit is contained in:
Jose Diaz-Gonzalez
2015-09-07 00:39:28 -04:00
parent ac2652fd92
commit b3156c5553
9 changed files with 177 additions and 66 deletions

View File

@@ -1,17 +1,24 @@
shellcheck:
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
ifeq ($(shell uname),Darwin)
brew install shellcheck
brew install shellcheck
else
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
sudo apt-get update && sudo apt-get install -y shellcheck
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
sudo apt-get update -qq && sudo apt-get install -qq -y shellcheck
endif
endif
bats:
ifeq ($(shell bats > /dev/null 2>&1 ; echo $$?),127)
ifeq ($(shell uname),Darwin)
git clone https://github.com/sstephenson/bats.git /tmp/bats
cd /tmp/bats && sudo ./install.sh /usr/local
rm -rf /tmp/bats
else
sudo add-apt-repository ppa:duggan/bats --yes
sudo apt-get update -qq && sudo apt-get install -qq -y bats
endif
endif
ci-dependencies: shellcheck bats
@@ -21,10 +28,14 @@ lint:
# SC2068: Double quote array expansions, otherwise they're like $* and break on spaces. - https://github.com/koalaman/shellcheck/wiki/SC2068
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
@echo linting...
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2046,SC2068,SC2086
@$(QUIET) find ./ -maxdepth 1 -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2046,SC2068,SC2086
unit-tests:
@echo running unit tests...
@$(QUIET) bats tests/unit
@$(QUIET) bats tests
test: ci-dependencies lint unit-tests
setup:
bash tests/setup.sh
$(MAKE) ci-dependencies
test: setup lint unit-tests