-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
191 lines (144 loc) · 5.95 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
################################################################################
# executables
################################################################################
NPM_CHECK=node_modules/.bin/npm-check
MVERSION=node_modules/mversion/bin/version
POLVO=node_modules/polvo/bin/polvo
SELENIUM=test/services/selenium.jar
SAUCE_CONNECT=test/services/Sauce-Connect.jar
CHROME_DRIVER=test/services/chromedriver
MOCHA=node_modules/mocha/bin/mocha
COVERALLS=node_modules/coveralls/bin/coveralls.js
CODECLIMATE=node_modules/.bin/codeclimate
SPACEJAM=node_modules/.bin/spacejam
################################################################################
# variables
################################################################################
VERSION=`egrep -o '[0-9\.]{3,}' package.json -m 1`
################################################################################
# setup everything for development
################################################################################
setup: install_test_suite
@npm install
install_test_suite:
@mkdir -p test/services
@echo '-----'
@echo 'Downloading Selenium..'
@curl -o test/services/selenium.jar \
http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar
@echo 'Done.'
@echo '-----'
@echo 'Downloading Chrome Driver..'
@curl -o test/services/chromedriver.zip \
http://chromedriver.storage.googleapis.com/2.6/chromedriver_mac32.zip
@echo 'Done.'
@echo '-----'
@echo 'Unzipping chromedriver..'
@cd test/services/; unzip chromedriver.zip; \
rm chromedriver.zip; cd -
@echo 'Done.'
@echo '-----'
@echo 'Downloading Sauce Connect..'
@curl -o test/services/sauceconnect.zip \
http://saucelabs.com/downloads/Sauce-Connect-latest.zip
@echo '-----'
@echo 'Unzipping Sauce Connect..'
@cd test/services/; unzip sauceconnect.zip; \
rm NOTICE.txt license.html sauceconnect.zip; cd -
@echo '-----'
@echo 'Done.'
@echo
################################################################################
# run tests locally
################################################################################
test: test.fixture.build.prod
@$(MOCHA) --ui bdd --reporter spec --timeout 600000 \
test/tests/runner.js --env='local'
test.coverage: test.fixture.build.split
@$(MOCHA) --ui bdd --reporter spec --timeout 600000 \
test/tests/runner.js --env='local' --coverage
test.coverage.preview: test.coverage
@cd coverage/lcov-report && python -m SimpleHTTPServer 8080
################################################################################
# meteor tests
################################################################################
# run tests and show output in browser
test.meteor:
meteor test-packages ./
# run tests and show output in terminal
test.meteor.headless:
@$(SPACEJAM) test-packages ./
################################################################################
# more tests
################################################################################
test.all: test test.meteor.headless
################################################################################
# debugging fixture manually
################################################################################
test.fixture.watch:
@$(POLVO) -wsx --base test/fixtures/general
test.fixture.watch.split:
@$(POLVO) -wsxb test/fixtures/general
################################################################################
# builds fixture
################################################################################
test.fixture.build.prod:
@echo 'Building test/fixtures before testing..'
@$(POLVO) -rb test/fixtures/general > /dev/null
test.fixture.build.split:
@echo 'Compiling test/fixture before testing..'
@$(POLVO) -cxb test/fixtures/general > /dev/null
################################################################################
# starts selenium or 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)
################################################################################
# run tests in sauce labs
################################################################################
test.sauce: test.fixture.build.prod
@$(MOCHA) -ui bdd -reporter spec -timeout 600000 \
test/tests/runner.js --env='sauce labs'
test.sauce.coverage: test.fixture.build.split
@$(MOCHA) --ui bdd --reporter spec --timeout 600000 \
test/tests/runner.js --env='sauce labs' --coverage
test.sauce.coverage.coveralls: test.sauce.coverage
@sed -i.bak \
"s/^.*__split__\/lib/SF:lib/g" \
coverage/lcov.info
@$(CODECLIMATE) < coverage/lcov.info
@cat coverage/lcov.info | $(COVERALLS)
test.sauce.coverage.preview: test.sauce.coverage
@cd coverage/lcov-report && python -m SimpleHTTPServer 8080
################################################################################
# manages version bumps
################################################################################
bump.minor:
@$(MVERSION) minor
bump.major:
@$(MVERSION) major
bump.patch:
@$(MVERSION) patch
################################################################################
# checking / updating dependencies
################################################################################
deps.check:
@$(NPM_CHECK)
deps.upgrade:
@$(NPM_CHECK) -u
################################################################################
# sync & publish
################################################################################
sync.master:
git pull origin master && git push origin master
publish:
git tag -a $(VERSION) -m "Releasing $(VERSION)"
git push origin master --tags
npm publish
meteor publish
################################################################################
# OTHERS
################################################################################
.PHONY: test