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
|
project := jaeger_client
projects := jaeger_client crossdock
flake8 := flake8
COV_DIRS := $(projects:%=--cov %)
pytest_args := -s --tb short --cov-config .coveragerc $(COV_DIRS) tests
pytest := py.test $(pytest_args)
sources := $(shell find $(projects) tests -name '*.py' | grep -v version.py | grep -v thrift_gen)
test_args := --cov-report term-missing --cov-report xml --junitxml junit.xml
cover_args := --cov-report html
include crossdock/rules.mk
PY_PATH = $(PYTHONPATH):$(PWD)
.DEFAULT_GOAL := test
.PHONY: bootstrap
bootstrap:
[ "$$VIRTUAL_ENV" != "" ]
rm -rf *.egg-info || true
pip install -U 'pip>=9.0'
pip install 'setuptools>=20.8.1'
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-tests.txt
pip install virtualenv
python setup.py develop
.PHONY: test
test: clean
$(pytest) $(test_args) --benchmark-skip
.PHONY: test_ci
test_ci: clean test-import test lint
.PHONY: test-import
test-import:
virtualenv import-test
import-test/bin/pip install -e .
pip install "tornado$(TORNADO)" # Reinstall Tornado version for testing.
import-test/bin/python -c "import jaeger_client"
rm -rf import-test
.PHONY: test-perf
test-perf: clean
$(pytest) $(test_args) --benchmark-only
# --benchmark-histogram --benchmark-min-time=0.001
.PHONY: cover
cover: clean
$(pytest) $(cover_args) --benchmark-skip
open htmlcov/index.html
.PHONY: jenkins
jenkins: bootstrap
$(pytest) $(test_args) --benchmark-skip
.PHONY: clean
clean:
@find $(project) "(" -name "*.pyc" -o -name "coverage.xml" -o -name "junit.xml" ")" -delete
@find tests "(" -name "*.pyc" -o -name "coverage.xml" -o -name "junit.xml" -o -name __pycache__ ")" -delete
@find . "(" -name "*.pyc" -o -name "coverage.xml" -o -name "junit.xml" -o -name __pycache__ ")" -delete
@rm -rf jaeger_client.egg-info
@rm -rf .mypy_cache
.PHONY: lint
lint:
$(flake8) $(projects) tests
mypy $(project)
./scripts/check-license.sh
.PHONY: shell
shell:
ipython
# Generate jaeger thrifts
THRIFT_GEN_DIR=jaeger_client/thrift_gen
THRIFT_PACKAGE_PREFIX=jaeger_client.thrift_gen
THRIFT_VER=0.9.3
THRIFT_IMG=thrift:$(THRIFT_VER)
THRIFT_PY_ARGS=new_style,tornado
THRIFT=docker run -v "${PWD}:/data" -u $(shell id -u) $(THRIFT_IMG) thrift
idl-submodule:
git submodule init
git submodule update
thrift-image:
$(THRIFT) -version
.PHONY: thrift
thrift: idl-submodule thrift-image
rm -rf $(THRIFT_GEN_DIR)
mkdir $(THRIFT_GEN_DIR)
${THRIFT} -o /data --gen py:${THRIFT_PY_ARGS} -out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/jaeger.thrift
${THRIFT} -o /data --gen py:${THRIFT_PY_ARGS} -out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/zipkincore.thrift
${THRIFT} -o /data --gen py:${THRIFT_PY_ARGS} -out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/agent.thrift
${THRIFT} -o /data --gen py:${THRIFT_PY_ARGS} -out /data/$(THRIFT_GEN_DIR) /data/idl/thrift/sampling.thrift
rm -rf ${THRIFT_GEN_DIR}/*/*-remote
set -e; \
for f in $$(find ${THRIFT_GEN_DIR} -iname '*.py'); do \
echo fixing $$f; \
awk -f thrift-gen-fix.awk package_prefix=${THRIFT_PACKAGE_PREFIX} $$f > tmp; \
mv tmp $$f; \
done
update-license:
python scripts/updateLicense.py $(sources)
|