forked from hypothesis/h
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (95 loc) · 2.88 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
DOCKER_TAG = dev
GULP := node_modules/.bin/gulp
# Unless the user has specified otherwise in their environment, it's probably a
# good idea to refuse to install unless we're in an activated virtualenv.
ifndef PIP_REQUIRE_VIRTUALENV
PIP_REQUIRE_VIRTUALENV = 1
endif
export PIP_REQUIRE_VIRTUALENV
.PHONY: default
default: test
build/manifest.json: node_modules/.uptodate
$(GULP) build
## Clean up runtime artifacts (needed after a version update)
.PHONY: clean
clean:
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
rm -f node_modules/.uptodate .pydeps
rm -rf build
## Run the development H server locally
.PHONY: dev
dev: build/manifest.json .pydeps
@bin/hypothesis --dev init
@bin/hypothesis devserver
## Build hypothesis/hypothesis docker image
.PHONY: docker
docker:
git archive --format=tar.gz HEAD | docker build -t hypothesis/hypothesis:$(DOCKER_TAG) -
# Run docker container.
#
# This command exists for conveniently testing the Docker image locally in
# production mode. It assumes the services are being run using docker-compose
# in the `h_default` network.
.PHONY: run-docker
run-docker:
docker run \
--net h_default \
-e "APP_URL=http://localhost:5000" \
-e "AUTHORITY=localhost" \
-e "BROKER_URL=amqp://guest:guest@rabbit:5672//" \
-e "DATABASE_URL=postgresql://postgres@postgres/postgres" \
-e "ELASTICSEARCH_URL=http://elasticsearch:9200" \
-e "NEW_RELIC_APP_NAME=h (dev)" \
-e "NEW_RELIC_LICENSE_KEY" \
-e "SECRET_KEY=notasecret" \
-p 5000:5000 \
hypothesis/hypothesis:$(DOCKER_TAG)
## Run test suite
.PHONY: test
test: node_modules/.uptodate
@pip install -q tox
tox
$(GULP) test
.PHONY: test-py3
test-py3: node_modules/.uptodate
tox -e py36 -- tests/h/
.PHONY: lint
lint: .pydeps
flake8 h
flake8 tests
flake8 --select FI14 --exclude 'h/cli/*,tests/h/cli/*,h/util/uri.py,h/migrations/versions/*' h tests
.PHONY: docs
docs:
@pip install -q tox
tox -e docs
.PHONY: checkdocs
checkdocs:
@pip install -q tox
tox -e checkdocs
.PHONY: docstrings
docstrings:
@pip install -q tox
tox -e docstrings
.PHONY: checkdocstrings
checkdocstrings:
@pip install -q tox
tox -e checkdocstrings
################################################################################
# Fake targets to aid with deps installation
.pydeps: requirements.txt requirements-dev.in
@echo installing python dependencies
@pip install -r requirements-dev.in tox
@touch $@
node_modules/.uptodate: package.json
@echo installing javascript dependencies
@node_modules/.bin/check-dependencies 2>/dev/null || npm install
@touch $@
# Self documenting Makefile
.PHONY: help
help:
@echo "The following targets are available:"
@echo " clean Clean up runtime artifacts (needed after a version update)"
@echo " dev Run the development H server locally"
@echo " docker Build hypothesis/hypothesis docker image"
@echo " test Run the test suite (default)"