-
Notifications
You must be signed in to change notification settings - Fork 123
/
Makefile
93 lines (76 loc) · 2.57 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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)
all: submodules build
@echo
@echo "Looks like everything worked!"
@echo "Get some API keys (https://github.com/LockerProject/Locker/wiki/GettingAPIKeys) and then try running:"
@echo "./locker"
@echo
@echo "Once running, visit http://localhost:8042 in your web browser."
# install system level dependencies into deps/
deps:
./scripts/install-deps deps
@echo
@echo "Go ahead and run 'make'"
.PHONY: deps
# if building from git, make sure that the submodules are checked out
submodules:
@if [ -d ./.git -a -f ./.gitmodules -a ! -d ./Apps/dashboardv3/static/common/.git ]; then \
echo "Initializing submodules..."; \
git submodule update --init; \
fi
# 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 Locker ready to run
build: check_deps npm_modules build.json common
.PHONY: build
common:
@. scripts/use-deps.sh && \
make -C Apps/dashboardv3/static/common
# install node dependencies via npm
npm_modules:
@. scripts/use-deps.sh && \
npm install
.PHONY: npm_modules
# build.json allows Locker 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 $@ tests/$@
.PHONY: build.json
# run all of the tests
test: oldtest newtest
# new style mocha tests
MOCHA = ./node_modules/.bin/mocha
MOCHA_TESTS = $(shell find test -name "*.test.js")
newtest: build
@env INTEGRAL_CONFIG=test/config.json \
$(MOCHA) --growl --timeout 500 $(MOCHA_TESTS)
# old style vows tests
oldtest: build
cd tests && \
env NODE_PATH="$(PWD)/Common/node" \
node ./runTests.js
SUBDIR=locker-$(BUILD_NUMBER)
DISTFILE=$(SUBDIR).tar.gz
# create a ready-to-run tarball with a complete build inside
bindist: $(DISTFILE)
$(DISTFILE): submodules
./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-03-16
jenkins:
xvfb-run -a --server-args="-screen 0 1280x960x24" $(MAKE) test-bindist
clean:
rm -f "$(DISTFILE)" "$(TEMPLATE_OUTPUT)" build.json tests/build.json
rm -f "locker-git-*.tar.gz"
rm -rf node_modules