-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (77 loc) · 2.65 KB
/
Copy pathMakefile
File metadata and controls
99 lines (77 loc) · 2.65 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
SHELL := /bin/bash
PATH := ${GOPATH}/bin:$(PATH):/usr/local/go/bin/
ENV := env
VERSION := 3.9.7
PYTHON := python$(basename ${VERSION})
PIP := ${ENV}/bin/pip
PYTHON_PROJECTS := cbagent perfdaily perfrunner scripts spring unittests.py
.PHONY: docker
RUFF := ${ENV}/bin/ruff check ${PYTHON_PROJECTS}
# Bootstrap pyenv (installing the target Python if needed) and create the venv.
# Respects a preconfigured PYENV_ROOT, defaulting to $HOME/.pyenv.
# Must run as a single shell so that the pyenv shims are on PATH when the venv is created.
define bootstrap_venv
export PYENV_ROOT="$${PYENV_ROOT:-$$HOME/.pyenv}" && \
export PATH="$$PYENV_ROOT/bin:$$PATH" && \
eval "$$(pyenv init --path)" && \
pyenv install ${VERSION} -s && \
pyenv local ${VERSION} && \
${PYTHON} -m venv ${ENV}
endef
# Install all dependencies into the venv, then perfrunner itself (editable).
define build_env
${PIP} install --upgrade --quiet pip wheel setuptools
${PIP} install --quiet --no-warn-script-location -r requirements.txt
${PIP} install --quiet -e .
pwd > ${ENV}/lib/${PYTHON}/site-packages/perfrunner.pth
endef
all:
$(bootstrap_venv)
$(build_env)
clean:
rm -fr build perfrunner.egg-info dist cachestat dcptest kvgen cbindexperf rachell loader *.db *.log .coverage *.pid celery
find . -name '*.pyc' -o -name '*.pyo' -o -name __pycache__ | xargs rm -fr
pep8:
${RUFF}
ruff-fix:
${RUFF} --fix
test:
${ENV}/bin/coverage run --source=cbagent,perfrunner,spring -m pytest -v unittests.py
${ENV}/bin/coverage report
misspell:
go get -u github.com/client9/misspell/cmd/misspell
find go ${PYTHON_PROJECTS} -type f -not -name "*.txt" | xargs misspell -error
gofmt:
gofmt -e -d -s go && ! gofmt -l go | read
check: pep8 misspell gofmt test
vendor-sync:
go version
go get -u github.com/kardianos/govendor
govendor sync
cachestat:
go build ./go/cachestats
dcptest: vendor-sync
go build ./go/dcptest
buildquery: vendor-sync
go get -u golang.org/x/tools/cmd/goyacc
cd vendor/github.com/couchbase/query/parser/n1ql && sh build.sh
cbindexperf: buildquery
go build ./go/cbindexperf
kvgen: vendor-sync
go build ./go/kvgen
rachell:
go build ./go/rachell
loader:
go build ./go/loader
docker:
docker build --target perfrunner -t perflab/perfrunner docker
# Alias kept for the k8s worker image build and pods (see docker/Dockerfile and
# perfrunner/remote/kubernetes.py), which invoke this target by name.
docker-cloud-worker: all
CONTAINER_PASSWORD := puppet
docker-compose:
docker compose up -d --build perfrunner
docker exec -it perfrunner rm -rf ${ENV}
docker exec -it perfrunner make
docker exec -it perfrunner sh -c "echo 'root:${CONTAINER_PASSWORD}' | chpasswd"
docker exec -it perfrunner /bin/bash