-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathMakefile
141 lines (115 loc) · 4.29 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# ** MODIFY THIS FILE AS REQUIRED **
# ** ADD CUSTOM BUILD- & TEST-EXECUTION-COMMANDS HERE **
#
# Building & testing for development and CI environment
#
# Following binaries need to be installed and available in your PATH:
#
# * jsdoc
# * jshint
# * phantomjs
# * jscoverage-server
# * node
#
# CI-Tools (https://github.com/uxebu/ci-tools) need to be installed in:
#
# /opt/ci-tools
#
# The Jenkins-CI environment is executing the task `ci-run`:
#
# make ci-run
ifndef TEST_RUNNER
# CHANGE HERE, IF THE DEFAULT TEST-RUNNER IS SOMEWHERE ELSE
TEST_RUNNER=test/runner.html
TEST_RUNNER_COMPARE=test/runner-compare.html
TEST_RUNNER_QC=test/runner-qc.html
TEST_RUNNER_BUILD=test/runner-build.html
endif
ifndef WORKSPACE
WORKSPACE=${CURDIR}
endif
ifndef PROJECT_NAME
PROJECT_NAME = $(shell basename ${WORKSPACE})
endif
CURRENT_USER = $(shell whoami)
ifndef BASE_URL
BASE_URL=http://localhost/${CURRENT_USER}/${PROJECT_NAME}
endif
ifdef JOB_URL
# jenkins env URL params end with "/"
BASE_URL=${JOB_URL}ws
endif
ifdef GIT_BRANCH
SUB_DIR=/${shell echo ${GIT_BRANCH} | sed "s/origin\///"}
endif
# You can install the CI-Tools on your machine: https://github.com/uxebu/ci-tools
ifndef CI_TOOLS_DIR
CI_TOOLS_DIR=/opt/ci-tools
endif
ifndef TEMP_DIR
TEMP_DIR=${WORKSPACE}/tmp
endif
ifndef DIST_DIR
DIST_DIR=${WORKSPACE}/dist
endif
CLOSURE=java -jar lib/closure/compiler.jar
CLOSURE_AMD=${CLOSURE} \
--transform_amd_modules \
--process_common_js_modules \
--common_js_module_path_prefix src \
--output_wrapper '(function __bonsaiRunnerCode__(){%output%}());'
CLOSURE_FINALIZE=${CLOSURE}
CLOSURE_PRETTY=${CLOSURE} --formatting PRETTY_PRINT --compilation_level WHITESPACE_ONLY
default: build
jshint: mktemp
- jshint ${WORKSPACE}/src/ --config config/jshint.json > ${TEMP_DIR}/jshint-report.txt
coverage: mktemp
${CI_TOOLS_DIR}/bin/coverage_phantom.sh ${TEST_RUNNER} ${WORKSPACE}
test: mktemp
phantomjs --load-plugins=yes ${CI_TOOLS_DIR}/script/phantom_runner.js ${BASE_URL}/${TEST_RUNNER_BUILD} ${TEMP_DIR} 1 jasmine | grep -q "Testcase passed"
phantomjs --load-plugins=yes ${CI_TOOLS_DIR}/script/phantom_runner.js ${BASE_URL}/${TEST_RUNNER} ${TEMP_DIR} 0 jasmine
phantomjs --load-plugins=yes ${CI_TOOLS_DIR}/script/phantom_runner.js ${BASE_URL}/${TEST_RUNNER_COMPARE} ${TEMP_DIR} 0 jasmine
phantomjs --load-plugins=yes ${CI_TOOLS_DIR}/script/phantom_runner.js ${BASE_URL}/${TEST_RUNNER_QC} ${TEMP_DIR} 0 qc
test-phantom: mktemp
phantomjs test/phantom-runner-jasmine.js test/runner.html
syntux-diff: mktemp
${CI_TOOLS_DIR}/bin/syntux_diff.sh ${WORKSPACE}/src ${TEMP_DIR}
profile: mktemp
cd ${WORKSPACE}/example/profiling && npm install
- ${WORKSPACE}/example/profiling/run.js \
-b ${BUILD_NUMBER} \
-d 10000 \
-e ${BASE_URL}/test/bonsai_executor_src.html \
-j ${JOB_NAME} \
-r http://riak.ux:8098/riak/profile \
${WORKSPACE}/test/profile \
doc: mkjsdoc
jsdoc -r -d ${WORKSPACE}/jsdoc${SUB_DIR} ${WORKSPACE}/src || true
build: clean mkdist
${CLOSURE_AMD} --common_js_entry_module bootstrapper/_build/common.js \
src/bootstrapper/_build/common.js \
`find src -name '*.js' -not -path 'src/bootstrapper/_dev/*' -not -path 'src/bootstrapper/_build/*' -not -path 'src/bootstrapper/context/socketio/*' -not -path 'src/bootstrapper/context/node/*'` | ${CLOSURE_PRETTY} > ${DIST_DIR}/bonsai.js
echo "/*" > ${DIST_DIR}/bonsai.min.js
cat ${WORKSPACE}/LICENSE >> ${DIST_DIR}/bonsai.min.js
echo "*/" >> ${DIST_DIR}/bonsai.min.js
cat ${DIST_DIR}/bonsai.js | ${CLOSURE_FINALIZE} >> ${DIST_DIR}/bonsai.min.js
preview-bundle: build
mkdir -p ${TEMP_DIR}/preview-bundle/lib
mkdir -p ${TEMP_DIR}/preview-bundle/example
mkdir -p ${TEMP_DIR}/preview-bundle/dist
cp -R example/library ${TEMP_DIR}/preview-bundle/example
- rm ${TEMP_DIR}/preview-bundle/example/library/movies/assets/*.mp4
- rm ${TEMP_DIR}/preview-bundle/example/library/movies/assets/*.m4v
- rm ${TEMP_DIR}/preview-bundle/example/library/movies/assets/*.ogv
cp -R dist/*.min.js ${TEMP_DIR}/preview-bundle/dist
cp -R lib/requirejs ${TEMP_DIR}/preview-bundle/lib
cd ${TEMP_DIR} && tar czf bonsai-preview.tgz preview-bundle/
mktemp:
mkdir -p ${TEMP_DIR}
mkdist:
mkdir -p ${DIST_DIR}
mkjsdoc:
mkdir -p ${WORKSPACE}/jsdoc
clean:
rm -rf ${TEMP_DIR} ${DIST_DIR}
ci-run: clean build test coverage syntux-diff doc jshint profile