name: CIT Kafka

on:
  push:
    branches: [main]

  pull_request:
    branches: [main]

jobs:
  kafka:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.4.0

    - uses: actions/setup-go@v2
      with:
        go-version: ^1.17

    - name: Run kafka integration tests
      run: bash scripts/kafka-integration-test.sh
    
    services:
      zookeeper:
        image: bitnami/zookeeper
        ports:
          - 2181:2181
        env:
          ALLOW_ANONYMOUS_LOGIN: yes
      kafka:
        image: bitnami/kafka
        ports:
          - 9092:9092
        env:
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
          ALLOW_PLAINTEXT_LISTENER: yes
          KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
