/
Makefile
223 lines (167 loc) · 5.28 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
.PHONY: docs
THE=bin/the
POLVO=node_modules/polvo/bin/polvo
SELENIUM=tests/www/services/selenium-server-standalone-2.35.0.jar
SAUCE_CONNECT=tests/www/services/Sauce-Connect.jar
CHROME_DRIVER=tests/www/services/chromedriver
CS=node_modules/coffee-script/bin/coffee
MOCHA=node_modules/mocha/bin/mocha
COVERALLS=node_modules/coveralls/bin/coveralls.js
MVERSION=node_modules/mversion/bin/version
VERSION=`$(MVERSION) | sed -E 's/\* package.json: //g'`
YUIDOC=node_modules/yuidocjs/lib/cli.js
# SETTTING UP DEV ENV
#-------------------------------------------------------------------------------
install_test_suite:
@mkdir -p tests/www/services
@echo '-----'
@echo 'Downloading Selenium..'
@curl -o tests/www/services/selenium-server-standalone-2.35.0.jar \
https://selenium.googlecode.com/files/selenium-server-standalone-2.35.0.jar
@echo 'Done.'
@echo '-----'
@echo 'Downloading Chrome Driver..'
@curl -o tests/www/services/chromedriver.zip \
https://chromedriver.googlecode.com/files/chromedriver_mac32_2.3.zip
@echo 'Done.'
@echo '-----'
@echo 'Unzipping chromedriver..'
@cd tests/www/services/; unzip chromedriver.zip; \
rm chromedriver.zip; cd -
@echo 'Done.'
@echo '-----'
@echo 'Downloading Sauce Connect..'
@curl -o tests/www/services/sauceconnect.zip \
http://saucelabs.com/downloads/Sauce-Connect-latest.zip
@echo '-----'
@echo 'Unzipping Sauce Connect..'
@cd tests/www/services/; unzip sauceconnect.zip; \
rm NOTICE.txt license.html sauceconnect.zip; cd -
@echo '-----'
@echo 'Done.'
@echo
setup: install_test_suite
@echo '-----'
npm link
# DEVELOPING
#-------------------------------------------------------------------------------
# watch / build
watch:
$(CS) -wmco lib cli/src
build:
$(CS) -mco lib cli/src
# GENERATING DOCS
#-------------------------------------------------------------------------------
# docs generation
docs.www:
cd www/src && \
../../$(YUIDOC) \
--syntaxtype coffee \
-e .coffee \
-o ../../docs/www \
-t ../../docs/bootstrap-theme \
-H ../../docs/bootstrap-theme/helpers/helpers.js \
.
docs.www.server:
cd www/src && \
../../$(YUIDOC) \
--syntaxtype coffee \
-e .coffee \
-o ../../docs/www \
-t ../../docs/bootstrap-theme \
-H ../../docs/bootstrap-theme/helpers/helpers.js \
--server \
.
# TESTS
#-------------------------------------------------------------------------------
# SELENIUM & SAUCE CONNECT
test.selenium.run:
@java -jar $(SELENIUM) -Dwebdriver.chrome.driver=$(CHROME_DRIVER)
test.sauce.connect.run:
@java -jar $(SAUCE_CONNECT) $(SAUCE_USERNAME) $(SAUCE_ACCESS_KEY)
# BUILDING TEST APP
test.build.prod:
@echo 'Building app before testing..'
@$(THE) -r --base tests/www/probatus > /dev/null
test.build.split:
@echo 'Compiling app before testing..'
@# @$(THE) -c --base tests/www/probatus > /dev/null
@$(POLVO) -cxb tests/www/probatus > /dev/null
# NORMALIZING COVERAGE AND POSTING TO COVERALLS
test.cover.normalize:
@sed -i.bak \
"s/^.*public\/__split__\/theoricus\/www\/src\/theoricus/SF:theoricus/g" \
tests/www/coverage/lcov.info
test.cover.publish:
@cd tests/www/probatus/public/__split__/theoricus/www/src && \
cat ../../../../../../coverage/lcov.info | \
../../../../../../../../$(COVERALLS)
@cd ../../../../../../../../
# TESTING LOCALLY
test: test.build.prod
@$(MOCHA) --compilers coffee:coffee-script \
--ui bdd \
--reporter spec \
--timeout 600000 \
tests/www/tests/runner.coffee --env='local'
test.cover: test.build.split
@$(MOCHA) --compilers coffee:coffee-script \
--ui bdd \
--reporter spec \
--timeout 600000 \
tests/www/tests/runner.coffee --env='local' --coverage
test.coveralls: test.cover test.cover.normalize test.cover.publish
test.cover.preview: test.cover
@cd tests/www/coverage/lcov-report; python -m SimpleHTTPServer 8080; cd -
# TESTING ON SAUCE LABS
# NOTE: The `--bail` option is hidden until Mocha fix the hooks execution
# https://github.com/visionmedia/mocha/issues/937
test.sauce: test.build.prod
@$(MOCHA) --compilers coffee:coffee-script \
--ui bdd \
--reporter spec \
--timeout 600000 \
tests/www/tests/runner.coffee --env='sauce labs'
test.sauce.cover: test.build.split
@$(MOCHA) --compilers coffee:coffee-script \
--ui bdd \
--reporter spec \
--timeout 600000 \
tests/www/tests/runner.coffee --env='sauce labs' --coverage
test.sauce.coveralls: test.sauce.cover test.cover.normalize test.cover.publish
test.travis:
# Technique (skipping pull requests) borrowed from WD:
# https://github.com/admc/wd/blob/master/Makefile
ifdef TRAVIS
# secure env variables are not available for pull reuqests
# so you won't be able to run test against Sauce on these
ifneq ($(TRAVIS_PULL_REQUEST),false)
@echo 'Skipping Sauce Labs tests as this is a pull request'
else
@make test.coveralls
endif
else
@make test.coveralls
endif
# MANAGING VERSIONS
#-------------------------------------------------------------------------------
bump.minor:
@$(MVERSION) minor
bump.major:
@$(MVERSION) major
bump.patch:
@$(MVERSION) patch
# PUBLISHING / RE-PUBLISHING
#-------------------------------------------------------------------------------
publish:
git tag $(VERSION)
git push origin $(VERSION)
git push origin master
npm publish
re-publish:
git tag -d $(VERSION)
git tag $(VERSION)
git push origin :$(VERSION)
git push origin $(VERSION)
git push origin master -f
npm publish -f