forked from mozilla/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
99 lines (79 loc) · 2.53 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
DC_CI = "bin/docker-compose.sh"
DC = $(shell which docker-compose)
default: help
@echo ""
@echo "You need to specify a subcommand."
@exit 1
help:
@echo "build - build docker images for dev"
@echo "run - docker-compose up the entire system for dev"
@echo ""
@echo "pull - pull the latest production images from Docker Hub"
@echo "shell - start the Django Python shell (bpython and shell_plus)"
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "rebuild - force a rebuild of all of the docker images"
@echo "submodules - resync and fetch the latest git submodules"
@echo "lint - check style with flake8, jshint, and stylelint"
@echo "test - run tests against local files"
@echo "test-image - run tests against files in docker image"
@echo "docs - generate Sphinx HTML documentation"
@echo "build-ci - build docker images for use in our CI pipeline"
@echo "test-ci - run tests against files in docker image built by CI"
.env:
@if [ ! -f .env ]; then \
echo "Copying .env-dist to .env..."; \
cp .env-dist .env; \
fi
.docker-build:
${MAKE} build
.docker-build-pull:
${MAKE} pull
build: .docker-build-pull
${DC} build app assets
touch .docker-build
pull: .env submodules
-GIT_COMMIT= ${DC} pull release app assets builder app-base
touch .docker-build-pull
rebuild: clean build
run: .docker-build-pull
${DC} up assets app
submodules:
git submodule sync
git submodule update -f --init --recursive
shell: .docker-build-pull
${DC} run app python manage.py shell_plus
clean:
# python related things
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
# test related things
-rm -f .coverage
# docs files
-rm -rf docs/_build/
# static files
-rm -rf static_build/
# state files
-rm -f .docker-build*
lint: .docker-build-pull
${DC} run test flake8 bedrock lib tests
${DC} run assets gulp js:lint css:lint
test: .docker-build-pull
${DC} run test
test-image: .docker-build
${DC} run test-image
docs: .docker-build-pull
${DC} run app make -C docs/ clean html
###############
# For use in CI
###############
.docker-build-ci:
${MAKE} build-ci
build-ci: .docker-build-pull
${DC_CI} build release
# tag intermediate images using cache
${DC_CI} build app assets builder app-base
touch .docker-build-ci
test-ci: .docker-build-ci
${DC_CI} run test-image
.PHONY: default clean build pull submodules docs lint run shell test test-image rebuild build-ci test-ci