This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
123 lines (95 loc) · 3.66 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
node_modules/@financial-times/n-gage/index.mk:
npm install --no-save @financial-times/n-gage
touch $@
-include node_modules/@financial-times/n-gage/index.mk
.PHONY: build
# n-ui has an unconventional a11y recipe
# so we ignore checking `make a11y` exists as part of provision
# Pa11y will still run locally and in CI
IGNORE_A11Y = true
demo: run
run: build-css-loader
ifneq ($(CIRCLECI),)
export NEXT_APP_SHELL=local; export FT_GRAPHITE_KEY=dummy; node demo/app
else
export NEXT_APP_SHELL=local; export FT_GRAPHITE_KEY=dummy; nodemon demo/app
endif
build:
webpack --config demo/webpack.config.js
build-production:
build-bundle
watch:
webpack --config demo/webpack.config.js --watch
test-browser:
karma start karma.conf.js
test-webpack:
mocha test/webpack.spec.js
# test-browser-dev is only for development environments.
test-browser-dev:
$(info *)
$(info * Developers note: This test will never "complete". It's meant to run in a separate tab. It'll automatically rerun tests whenever one of your files changes.)
$(info *)
karma start karma.conf.js --single-run false --auto-watch true
test-build:
webpack --config demo/webpack.config.js
test-server: export NODE_ENV=production
test-server: export HOSTEDGRAPHITE_APIKEY=dummykey
test-server: export FT_GRAPHITE_KEY=test-graphite-key
test-server: copy-stylesheet-partial
ifneq ($(CIRCLECI),)
ifeq ($(CIRCLE_TAG),)
make test-server-coverage && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
else
make test-server-plain
endif
else
make test-server-plain
endif
test-server-plain:
mocha server/test/*.test.js server/test/**/*.test.js
copy-stylesheet-partial:
cp browser/layout/partials/stylesheets.html server/test/fixtures/app/views/partials
build-css-loader:
uglifyjs browser/layout/src/css-loader.js -o browser/layout/partials/css-loader.html
build-bundle:
webpack -p --bail --config build/deploy/webpack.deploy.config.js
build-dist: build-bundle build-css-loader
node ./build/deploy/build-auxilliary-files.js
deploy-s3:
# deploy to urls using the real file name on s3
node ./build/deploy/s3.js
# deploy to hashed urls on s3
nht deploy-hashed-assets --directory public/n-ui --monitor-assets
rebuild-user-facing-apps:
# Don't rebuild apps if a beta tag release
ifneq (,$(findstring beta,$(CIRCLE_TAG)))
echo "This looks like a beta release so I won't rebuild any apps";
else
# only autodeploy all apps in office hours
HOUR=$$(date +%H); DAY=$$(date +%u); if [ $$HOUR -ge 8 ] && [ $$HOUR -lt 16 ] && [ $$DAY -ge 0 ] && [ $$DAY -lt 6 ]; then \
echo "REBUILDING ALL APPS" && nht rebuild --all --serves user-page; fi
endif
test-server-coverage: ## test-server-coverage: Run the unit tests with code coverage enabled.
istanbul cover node_modules/.bin/_mocha --report=$(if $(CIRCLECI),lcovonly,lcov) server/test/*.test.js server/test/**/*.test.js
nightwatch:
nht nightwatch browser/test/js-success.nightwatch.js
pally-conf:
node .pa11yci.js
a11y: test-build pally-conf
rm -rf bower_components/n-ui
mkdir bower_components/n-ui
PA11Y=true node demo/app
# Note: `run` executes `node demo/app`, which fires up express, then deploys
# a test static site to s3, then exits, freeing the process to execute `nightwatch a11y`.
test: developer-note verify pally-conf test-server test-browser test-build test-webpack run nightwatch a11y build-dist
developer-note:
ifeq ($(NODE_ENV),) # Not production
ifeq ($(CIRCLE_BRANCH),) # Not CircleCI
$(info *)
$(info * Developers note: `make test` is meant for CircleCI, not development. Instead, you should `make test-dev`.)
$(info *)
endif
endif
# Test-dev is only for development environments.
test-dev: verify test-browser-dev test-webpack
deploy: deploy-s3 npm-publish rebuild-user-facing-apps