name: CIT OpenSearch

on:
  push:
    branches: [main]

  pull_request:
    branches: [main]

jobs:
  opensearch:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        version:
        - major: 1.x
          image: 1.0.0
          distribution: opensearch
    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 opensearch integration tests
      run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }}
