-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathMakefile
More file actions
163 lines (135 loc) · 4.15 KB
/
Copy pathMakefile
File metadata and controls
163 lines (135 loc) · 4.15 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the PostgreSQL License.
.DEFAULT_GOAL := all
include Makefile.docker
#
# Main build targets
#
.PHONY: all
all: monitor bin ;
.PHONY: bin
bin: version
$(MAKE) -C src/bin/ all
.PHONY: monitor
monitor:
$(MAKE) -C src/monitor/ all
.PHONY: install
install: install-monitor install-bin ;
.PHONY: install-bin
install-bin: bin
$(MAKE) -C src/bin/ install
.PHONY: install-monitor
install-monitor: monitor
$(MAKE) -C src/monitor/ install
.PHONY: clean
clean: clean-monitor clean-bin ;
.PHONY: clean-bin
clean-bin:
$(MAKE) -C src/bin/ clean
.PHONY: clean-monitor
clean-monitor:
$(MAKE) -C src/monitor/ clean
.PHONY: clean-version
clean-version:
rm -f $(VERSION_FILE)
.PHONY: maintainer-clean
maintainer-clean: clean-monitor clean-version clean-bin ;
#
# SQL regression tests (pg_regress installcheck)
#
.PHONY: check check-monitor
check: check-monitor ;
check-monitor: install-monitor
$(MAKE) -C src/monitor/ installcheck
# Run installcheck inside a Docker container using the base image.
# pg_virtualenv manages the temporary cluster; see Makefile.installcheck.
# Usage: make installcheck [PGVERSION=17]
.PHONY: installcheck
installcheck: version
docker run --rm \
-v "$(CURDIR):/usr/src/pg_auto_failover" \
-w /usr/src/pg_auto_failover \
$(BASE) \
make -f Makefile.installcheck installcheck PGVERSION=$(PGVERSION)
#
# Python test suite — delegate to tests/Makefile
#
.PHONY: test ci-test run-test run-test-prebuilt
test ci-test run-test run-test-prebuilt:
$(MAKE) -C tests $@ PGVERSION=$(PGVERSION) TEST='$(TEST)'
#
# INDENT/LINT/SPELLCHECK
#
# citus_indent is run via its official Docker image (citus/stylechecker:no-py)
# so that the local version exactly matches CI. When the local citus_indent
# binary is already in PATH (e.g. inside the stylechecker container) the plain
# binary is used instead, which is equally authoritative there.
#
# To check or auto-fix locally without installing citus_indent:
# make docker-check # check only
# make docker-indent # auto-fix
#
# citus_indent calls `git ls-files` to find the files it should look at, so
# the container needs a working .git. In a plain checkout that's already
# true (.git lives under $(CURDIR), which is mounted at /workdir). In a git
# worktree, $(CURDIR)/.git is only a pointer file ("gitdir: <main-repo>/.git/
# worktrees/<name>") to a path outside $(CURDIR) -- GIT_COMMON_DIR resolves
# that pointer on the host and the extra -v mounts it into the container at
# the identical absolute path, so it still resolves there too. This is a
# harmless no-op for a plain checkout (it just mounts $(CURDIR)/.git over
# itself).
GIT_COMMON_DIR := $(shell cd "$(CURDIR)" && cd "$$(git rev-parse --git-common-dir 2>/dev/null)" 2>/dev/null && pwd)
CITUS_INDENT_DOCKER = docker run --rm \
-v "$(CURDIR):/workdir" \
$(if $(GIT_COMMON_DIR),-v "$(GIT_COMMON_DIR):$(GIT_COMMON_DIR)") \
-w /workdir \
citus/stylechecker:no-py \
citus_indent
.PHONY: indent
indent:
citus_indent
black --exclude=ci/tools .
.PHONY: docker-indent docker-check
docker-indent:
$(CITUS_INDENT_DOCKER)
docker-check:
$(CITUS_INDENT_DOCKER) --check
.PHONY: lint linting spellcheck
lint linting: spellcheck ;
spellcheck:
$(CITUS_INDENT_DOCKER) --check
black --exclude=ci/tools --check .
ci/banned.h.sh
#
# DOCS
#
FSM = docs/fsm.png
PDF = ./docs/_build/latex/pg_auto_failover.pdf
DOCS_PORT = 8000
PG_AUTOCTL = PG_AUTOCTL_DEBUG=1 ./src/bin/pg_autoctl/pg_autoctl
.PHONY: man
man:
$(MAKE) -C docs man
.PHONY: pdf
pdf: $(PDF) ;
$(PDF):
$(MAKE) -s -C docs/tikz pdf
perl -pi -e 's/(^.. figure:: .*)\.svg/\1.pdf/' docs/*.rst
perl -pi -e 's/▒/~/g' docs/ref/pg_autoctl_do_demo.rst
$(MAKE) -s -C docs latexpdf
perl -pi -e 's/(^.. figure:: .*)\.pdf/\1.svg/' docs/*.rst
perl -pi -e 's/~/▒/g' docs/ref/pg_autoctl_do_demo.rst
ls -l $@
$(FSM): bin
$(PG_AUTOCTL) do fsm gv | dot -Tpng > $@
.PHONY: docs
docs: $(FSM) tikz
$(MAKE) -C docs html
.PHONY: tikz
tikz:
$(MAKE) -C docs/tikz all
.PHONY: build-docs serve-docs
build-docs:
docker build -t pg_auto_failover:docs -f Dockerfile.docs .
serve-docs: build-docs
docker run --rm -it -p $(DOCS_PORT):8000 pg_auto_failover:docs