-
Notifications
You must be signed in to change notification settings - Fork 592
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (114 loc) · 4.31 KB
/
Makefile
File metadata and controls
139 lines (114 loc) · 4.31 KB
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
TEST?=ralph
TEST_ARGS=
DOCKER_REPO_NAME?=allegro
DOCKER?=docker
RALPH_VERSION?=$(shell git describe --abbrev=0)
.PHONY: test flake clean coverage docs coveralls
# release-new-version is used by ralph mainteiners prior to publishing
# new version of the package. The command generates the debian changelog
# commits it and tags the created commit with the appropriate snapshot version.
release-new-version: new_version = $(shell ./get_version.sh generate)
release-new-version:
$(DOCKER) build \
--force-rm \
-f docker/Dockerfile-deb \
--build-arg GIT_USER_NAME="$(shell git config user.name)" \
--build-arg GIT_USER_EMAIL="$(shell git config user.email)" \
-t ralph-deb:latest .
$(DOCKER) run --rm -it -v $(shell pwd):/volume ralph-deb:latest release-new-version
$(DOCKER) image rm --force ralph-deb:latest
git add debian/changelog
git commit -m "Updated changelog for $(new_version) version."
git tag -m $(new_version) -a $(new_version)
# build-package builds a release version of the package using the generated
# changelog and the tag.
build-package:
$(DOCKER) build --force-rm -f docker/Dockerfile-deb -t ralph-deb:latest .
$(DOCKER) run --rm -v $(shell pwd):/volume ralph-deb:latest build-package
$(DOCKER) image rm --force ralph-deb:latest
# build-snapshot-package renerates a snapshot changelog and uses it to build
# snapshot version of the package. It is mainly used for testing.
build-snapshot-package:
$(DOCKER) build --force-rm -f docker/Dockerfile-deb -t ralph-deb:latest .
$(DOCKER) run --rm -v $(shell pwd):/volume ralph-deb:latest build-snapshot-package
$(DOCKER) image rm --force ralph-deb:latest
build-docker-image:
$(DOCKER) build \
--no-cache \
-f docker/Dockerfile-prod \
--build-arg RALPH_VERSION="$(RALPH_VERSION)" \
-t $(DOCKER_REPO_NAME)/ralph:latest \
-t "$(DOCKER_REPO_NAME)/ralph:$(RALPH_VERSION)" .
$(DOCKER) build \
-f docker/Dockerfile-inkpy \
-t "$(DOCKER_REPO_NAME)/inkpy:$(RALPH_VERSION)" .
$(DOCKER) build \
--no-cache \
-f docker/Dockerfile-static \
--build-arg RALPH_VERSION="$(RALPH_VERSION)" \
-t $(DOCKER_REPO_NAME)/ralph-static-nginx:latest \
-t "$(DOCKER_REPO_NAME)/ralph-static-nginx:$(RALPH_VERSION)" .
build-snapshot-docker-image: version = $(shell ./get_version.sh show)
build-snapshot-docker-image: build-snapshot-package
$(DOCKER) build \
-f docker/Dockerfile-prod \
--build-arg RALPH_VERSION="$(version)" \
--build-arg SNAPSHOT="1" \
-t $(DOCKER_REPO_NAME)/ralph:latest \
-t "$(DOCKER_REPO_NAME)/ralph:$(version)" .
$(DOCKER) build \
-f docker/Dockerfile-inkpy \
-t "$(DOCKER_REPO_NAME)/inkpy:$(version)" .
$(DOCKER) build \
-f docker/Dockerfile-static \
--build-arg RALPH_VERSION="$(version)" \
-t "$(DOCKER_REPO_NAME)/ralph-static-nginx:$(version)" .
publish-docker-image: build-docker-image
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph:$(RALPH_VERSION)
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph:latest
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph-static-nginx:$(RALPH_VERSION)
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph-static-nginx:latest
$(DOCKER) push $(DOCKER_REPO_NAME)/inkpy:$(RALPH_VERSION)
publish-docker-snapshot-image: version = $(shell ./get_version.sh show)
publish-docker-snapshot-image: build-snapshot-docker-image
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph:$(version)
$(DOCKER) push $(DOCKER_REPO_NAME)/inkpy:$(version)
$(DOCKER) push $(DOCKER_REPO_NAME)/ralph-static-nginx:$(version)
install-js:
npm install
./node_modules/.bin/gulp
js-hint:
find src/ralph|grep "\.js$$"|grep -v vendor|xargs ./node_modules/.bin/jshint;
install: install-js
pip3 install -r requirements/prod.txt
install-test:
pip3 install -r requirements/test.txt
install-dev:
pip3 install -r requirements/dev.txt
install-docs:
pip3 install -r requirements/docs.txt
isort:
isort --diff --recursive --check-only --quiet src
test: clean
test_ralph test $(TEST) $(TEST_ARGS)
flake: isort
flake8 src/ralph
flake8 src/ralph/settings --ignore=F405 --exclude=*local.py
@cat scripts/flake.txt
checks:
ruff check src
clean:
find . -name '*.py[cod]' -delete;
coverage: clean
coverage run $(shell which test_ralph) test $(TEST) -v 2 --keepdb --settings="ralph.settings.test"
coverage report
docs: install-docs
mkdocs build
run:
dev_ralph runserver_plus 0.0.0.0:8000
menu:
ralph sitetree_resync_apps
translate_messages:
ralph makemessages -a
compile_messages:
ralph compilemessages