forked from dokku/dokku-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (42 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
shellcheck:
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
ifeq ($(shell uname),Darwin)
brew install shellcheck
else
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
readlink:
ifeq ($(shell uname),Darwin)
ifeq ($(shell greadlink > /dev/null 2>&1 ; echo $$?),127)
brew install coreutils
endif
ln -nfs `which greadlink` tests/bin/readlink
endif
ci-dependencies: shellcheck bats readlink
lint:
# these are disabled due to their expansive existence in the codebase. we should clean it up though
# SC1090: Can't follow non-constant source. Use a directive to specify location.
# SC2034: Variable appears unused. Verify it or export it.
# SC2155: Declare and assign separately to avoid masking return values.
@echo linting...
@$(QUIET) find ./ -maxdepth 1 -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC1090,SC2034,SC2155
unit-tests:
@echo running unit tests...
@$(QUIET) bats tests
setup:
bash tests/setup.sh
$(MAKE) ci-dependencies
test: setup lint unit-tests