|
1 |
| -# Some simple testing tasks (sorry, UNIX only). |
| 1 | +# Some simple testing tasks |
2 | 2 |
|
3 |
| -FLAGS= |
4 |
| -KAFKA_VERSION=0.11.0.2 |
5 |
| -SCALA_VERSION=2.12 |
| 3 | +SHELL = bash |
| 4 | + |
| 5 | +export KAFKA_VERSION ?= 2.4.0 |
| 6 | +DIST_BASE_URL ?= https://archive.apache.org/dist/kafka/ |
| 7 | + |
| 8 | +# Required to support testing old kafka versions on newer java releases |
| 9 | +# The performance opts defaults are set in each kafka brokers bin/kafka_run_class.sh file |
| 10 | +# The values here are taken from the 2.4.0 release. |
| 11 | +export KAFKA_JVM_PERFORMANCE_OPTS=-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true |
6 | 12 |
|
7 | 13 | setup:
|
8 | 14 | pip install -r requirements-dev.txt
|
9 | 15 | pip install -Ue .
|
10 | 16 |
|
11 |
| -servers/$(KAFKA_VERSION)/kafka-bin: |
12 |
| - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) ./build_integration.sh |
13 |
| - |
14 |
| -build-integration: servers/$(KAFKA_VERSION)/kafka-bin |
15 |
| - |
16 |
| -# Test and produce coverage using tox. This is the same as is run on Travis |
17 |
| -test37: build-integration |
18 |
| - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py37 -- $(FLAGS) |
| 17 | +lint: |
| 18 | + pylint --recursive=y --errors-only kafka test |
19 | 19 |
|
20 |
| -test27: build-integration |
21 |
| - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py27 -- $(FLAGS) |
| 20 | +test: build-integration |
| 21 | + pytest --durations=10 kafka test |
22 | 22 |
|
23 | 23 | # Test using pytest directly if you want to use local python. Useful for other
|
24 | 24 | # platforms that require manual installation for C libraries, ie. Windows.
|
25 | 25 | test-local: build-integration
|
26 |
| - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) pytest \ |
27 |
| - --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF $(FLAGS) kafka test |
| 26 | + pytest --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF $(TEST_FLAGS) kafka test |
28 | 27 |
|
29 | 28 | cov-local: build-integration
|
30 |
| - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) pytest \ |
31 |
| - --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF --cov=kafka \ |
32 |
| - --cov-config=.covrc --cov-report html $(FLAGS) kafka test |
| 29 | + pytest --pylint --pylint-rcfile=pylint.rc --pylint-error-types=EF --cov=kafka \ |
| 30 | + --cov-config=.covrc --cov-report html $(TEST_FLAGS) kafka test |
33 | 31 | @echo "open file://`pwd`/htmlcov/index.html"
|
34 | 32 |
|
35 | 33 | # Check the readme for syntax errors, which can lead to invalid formatting on
|
|
56 | 54 | make -C docs html
|
57 | 55 | @echo "open file://`pwd`/docs/_build/html/index.html"
|
58 | 56 |
|
59 |
| -.PHONY: all test37 test27 test-local cov-local clean doc |
| 57 | +.PHONY: all test test-local cov-local clean doc dist publish |
| 58 | + |
| 59 | +kafka_artifact_version=$(lastword $(subst -, ,$(1))) |
| 60 | + |
| 61 | +# Mappings for artifacts -> scala version; any unlisted will use default 2.12 |
| 62 | +kafka_scala_0_8_0=2.8.0 |
| 63 | +kafka_scala_0_8_1=2.10 |
| 64 | +kafka_scala_0_8_1_1=2.10 |
| 65 | +kafka_scala_0_8_2_0=2.11 |
| 66 | +kafka_scala_0_8_2_1=2.11 |
| 67 | +kafka_scala_0_8_2_2=2.11 |
| 68 | +kafka_scala_0_9_0_0=2.11 |
| 69 | +kafka_scala_0_9_0_1=2.11 |
| 70 | +kafka_scala_0_10_0_0=2.11 |
| 71 | +kafka_scala_0_10_0_1=2.11 |
| 72 | +kafka_scala_0_10_1_0=2.11 |
| 73 | +scala_version=$(if $(SCALA_VERSION),$(SCALA_VERSION),$(if $(kafka_scala_$(subst .,_,$(1))),$(kafka_scala_$(subst .,_,$(1))),2.12)) |
| 74 | + |
| 75 | +kafka_artifact_name=kafka_$(call scala_version,$(1))-$(1).$(if $(filter 0.8.0,$(1)),tar.gz,tgz) |
| 76 | + |
| 77 | +build-integration: servers/$(KAFKA_VERSION)/kafka-bin |
| 78 | + |
| 79 | +servers/dist: |
| 80 | + mkdir -p servers/dist |
| 81 | + |
| 82 | +servers/dist/kafka_%.tgz servers/dist/kafka_%.tar.gz: |
| 83 | + @echo "Downloading $(@F)" |
| 84 | + wget -nv -P servers/dist/ -N $(DIST_BASE_URL)$(call kafka_artifact_version,$*)/$(@F) |
| 85 | + |
| 86 | +servers/dist/jakarta.xml.bind-api-2.3.3.jar: |
| 87 | + wget -nv -P servers/dist/ -N https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar |
| 88 | + |
| 89 | +# to allow us to derive the prerequisite artifact name from the target name |
| 90 | +.SECONDEXPANSION: |
| 91 | + |
| 92 | +servers/%/kafka-bin: servers/dist/$$(call kafka_artifact_name,$$*) | servers/dist |
| 93 | + @echo "Extracting kafka $* binaries from $<" |
| 94 | + if [ -d "$@" ]; then rm -rf $@.bak; mv $@ $@.bak; fi |
| 95 | + mkdir $@ |
| 96 | + tar xzvf $< -C $@ --strip-components 1 |
| 97 | + if [[ "$*" < "1" ]]; then make servers/patch-libs/$*; fi |
| 98 | + |
| 99 | +servers/patch-libs/%: servers/dist/jakarta.xml.bind-api-2.3.3.jar | servers/$$*/kafka-bin |
| 100 | + cp $< servers/$*/kafka-bin/libs/ |
| 101 | + |
| 102 | +servers/download/%: servers/dist/$$(call kafka_artifact_name,$$*) | servers/dist ; |
| 103 | + |
| 104 | +# Avoid removing any pattern match targets as intermediates (without this, .tgz artifacts are removed by make after extraction) |
| 105 | +.SECONDARY: |
0 commit comments