name: CIT Elasticsearch

on:
  push:
    branches: [main]

  pull_request:
    branches: [main]

jobs:
  elasticsearch:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        version:
        - major: 5.x
          image: 5.6.16
          distribution: elasticsearch
        - major: 6.x
          image: 6.8.18
          distribution: elasticsearch
        - major: 7.x
          image: 7.14.0
          distribution: elasticsearch
    name: ${{ matrix.version.distribution }} ${{ matrix.version.major }}
    steps:
    - uses: actions/checkout@v2.4.0
      with:
        submodules: true

    - name: Fetch git tags
      run: |
        git fetch --prune --unshallow --tags

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

    - name: Install tools
      run: make install-ci

    - uses: docker/setup-qemu-action@v1

    - name: Run elasticsearch integration tests
      run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }}
