forked from pypi/warehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
96 lines (71 loc) · 2.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
DB := example
IPYTHON := no
# set environment variable WAREHOUSE_IPYTHON_SHELL=1 if IPython
# needed in development environment
ifeq ($(WAREHOUSE_IPYTHON_SHELL), 1)
IPYTHON = yes
endif
default:
@echo "Call a specific subcommand:"
@echo
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null\
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
| sort\
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
@echo
@exit 1
.state/docker-build: Dockerfile package.json package-lock.json requirements/main.txt requirements/deploy.txt
# Build our docker containers for this project.
docker-compose build --build-arg IPYTHON=$(IPYTHON) --force-rm web
docker-compose build --force-rm worker
docker-compose build --force-rm static
# Mark the state so we don't rebuild this needlessly.
mkdir -p .state
touch .state/docker-build
build:
@$(MAKE) .state/docker-build
docker system prune -f --filter "label=com.docker.compose.project=warehouse"
serve: .state/docker-build
docker-compose up --remove-orphans
debug: .state/docker-build
docker-compose run --rm --service-ports web
tests: .state/docker-build
docker-compose run --rm web bin/tests --postgresql-host db $(T) $(TESTARGS)
static_tests: .state/docker-build
docker-compose run --rm static bin/static_tests $(T) $(TESTARGS)
static_pipeline: .state/docker-build
docker-compose run --rm static bin/static_pipeline $(T) $(TESTARGS)
reformat: .state/docker-build
docker-compose run --rm web bin/reformat
lint: .state/docker-build
docker-compose run --rm web bin/lint && bin/static_lint
docs: .state/docker-build
docker-compose run --rm web bin/docs
licenses: .state/docker-build
docker-compose run --rm web bin/licenses
deps: .state/docker-build
docker-compose run --rm web bin/deps
translations: .state/docker-build
docker-compose run --rm web bin/translations
requirements/%.txt: requirements/%.in
docker-compose run --rm web bin/pip-compile --allow-unsafe --generate-hashes --output-file=$@ $<
initdb:
docker-compose run --rm web psql -h db -d postgres -U postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname ='warehouse';"
docker-compose run --rm web psql -h db -d postgres -U postgres -c "DROP DATABASE IF EXISTS warehouse"
docker-compose run --rm web psql -h db -d postgres -U postgres -c "CREATE DATABASE warehouse ENCODING 'UTF8'"
xz -d -f -k dev/$(DB).sql.xz --stdout | docker-compose run --rm web psql -h db -d warehouse -U postgres -v ON_ERROR_STOP=1 -1 -f -
docker-compose run --rm web python -m warehouse db upgrade head
$(MAKE) reindex
docker-compose run web python -m warehouse sponsors populate-db
reindex:
docker-compose run --rm web python -m warehouse search reindex
shell:
docker-compose run --rm web python -m warehouse shell
clean:
rm -rf dev/*.sql
purge: stop clean
rm -rf .state
docker-compose rm --force
stop:
docker-compose down -v
.PHONY: default build serve initdb shell tests docs deps clean purge debug stop compile-pot