picokafka 0.1.13

Kafka library for tarantool-module based on librdkafka.
Documentation
KAFKA_IMAGE = "docker.binary.picodata.io/confluentinc/cp-kafka:latest"

ifeq ($(CI), true)
  UID="-u $(shell id -u gitlab-runner)"
endif

# need for use from template-ci for some local action
local-env: ;

kafka-up:
	docker-compose -f tests/docker-compose.yml down
	docker run --rm -v $(PWD)/tests:/opt/kafka:rw $(UID) $(KAFKA_IMAGE) /opt/kafka/setup_ssl.sh
	docker-compose -f tests/docker-compose.yml up -d

lint: rust-lint

rust-lint:
	cargo clippy --all-features --tests
	cargo fmt --check --all

test:
ifeq ($(CI), true)
    # blocks until kafka is reachable
	kafka-topics.sh --bootstrap-server kafka:9092 --list

	echo -e 'Creating kafka topics'
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_output --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_output_multiple_topics_1 --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_output_multiple_topics_2 --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_drop --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_seek --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_subscribe_unsubscribe --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_consumer_manual_commit --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_send --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_tarantool_send --replication-factor 1 --partitions 1
	kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic test_tarantool_auth --replication-factor 1 --partitions 1

	echo -e 'Successfully created the following topics:'
	kafka-topics.sh --bootstrap-server kafka:9092 --list

	cargo build --features skip_ssl_test
else
	cargo build
endif
	tarantool-test -p ./target/debug/libtests.so

kafka-down:
	docker-compose -f tests/docker-compose.yml down

publish-dry-run:
	cargo publish --dry-run -p picokafka --all-features

publish:
	cargo publish -p picokafka --all-features

clean:
	cargo clean