-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
79 lines (63 loc) · 2.02 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
export GIT_REVISION?=$(shell git rev-parse --short --default HEAD)
# if not provided by Jenkins, then just use the gitrev
export BUILD_NUMBER?=git-$(GIT_REVISION)
.PHONY: deps build npm_modules build.json
all: build
@echo
@echo "Looks like everything worked!"
@echo
# install system level dependencies into deps/
deps:
./scripts/install-deps deps
@echo
@echo "Go ahead and run 'make'"
# check if system level dependencies are installed
check_deps:
@. scripts/use-deps.sh && \
if ! ./scripts/install-deps --check-only; then \
echo Some dependencies are missing. Try running "make deps" to install them.; \
exit 1; \
fi
# Get Hallway ready to run
build: check_deps npm_modules build.json
# install node dependencies via npm
npm_modules:
@. scripts/use-deps.sh && \
npm install
# build.json allows Hallway to report its build number and git revision at runtime
# the test suite pretends that tests/ is the top of the source tree,
# so drop a copy there too
build.json:
@echo '{ "build" : "$(BUILD_NUMBER)", "gitrev" : "$(GIT_REVISION)" }' \
| tee $@ test/$@
MOCHA = ./node_modules/.bin/mocha
MOCHA_TESTS = $(shell find test -name "*.test.js")
test: build
@env NODE_PATH="lib" \
$(MOCHA) $(MOCHA_TESTS)
MOCHA_UNIT_TESTS=$(shell find test -name "*.unit.test.js")
unittest: build
@env NODE_PATH="lib" \
$(MOCHA) $(MOCHA_UNIT_TESTS)
_MOCHA=./node_modules/.bin/_mocha
COVER=./node_modules/cover/bin/cover
cov: check_deps npm_modules
@env NODE_PATH="lib" \
$(COVER) run $(_MOCHA) $(MOCHA_TESTS)
$(COVER) report html
SUBDIR=hallway-$(BUILD_NUMBER)
DISTFILE=$(SUBDIR).tar.gz
# create a ready-to-run tarball with a complete build inside
bindist: $(DISTFILE)
$(DISTFILE):
./scripts/build-tarball "$(SUBDIR)" "$@"
# create a ready-to-run tarball, and then run tests on the contents
test-bindist: $(DISTFILE)
./scripts/test-tarball "$(SUBDIR)" "$<"
# this is the rule that Jenkins runs as of 2012-04-18
jenkins:
$(MAKE) test-bindist
clean:
rm -f "$(DISTFILE)" build.json test/build.json
rm -f "hallway-git-*.tar.gz"
rm -rf node_modules