version: 2
jobs:
  unit:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec
      - run: bundle exec rubocop

  kafka-0.11:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.11-0.11.0.3
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-0.11.0.3
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-0.11.0.3
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-1.0.0:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.11-1.0.2
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-1.0.2
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-1.0.2
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-1.1:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.11-1.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-1.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-1.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.0:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.11-2.0.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-2.0.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.11-2.0.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.1:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.12-2.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.1.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.2:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.12-2.2.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.2.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.2.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.3:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.12-2.3.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.3.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.3.1
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.4:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.12-2.4.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.4.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.4.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

  kafka-2.5:
    docker:
      - image: circleci/ruby:2.5.1-node
        environment:
          LOG_LEVEL: DEBUG
      - image: wurstmeister/zookeeper
      - image: wurstmeister/kafka:2.12-2.5.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_PORT: 9092
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.5.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_PORT: 9093
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
      - image: wurstmeister/kafka:2.12-2.5.0
        environment:
          KAFKA_ADVERTISED_HOST_NAME: localhost
          KAFKA_ADVERTISED_PORT: 9094
          KAFKA_PORT: 9094
          KAFKA_ZOOKEEPER_CONNECT: localhost:2181
          KAFKA_DELETE_TOPIC_ENABLE: true
    steps:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rspec --profile --tag functional spec/functional

workflows:
  version: 2
  test:
    jobs:
      - unit
      - kafka-0.11
      - kafka-1.0.0
      - kafka-1.1
      - kafka-2.0
      - kafka-2.1
      - kafka-2.2
      - kafka-2.3
      - kafka-2.4
      - kafka-2.5
