name: 7.x with 8.x
on:
  push:
    branches:
      - 7.17
  pull_request:
    branches:
      - 7.17
jobs:
  test-ruby:
    env:
      TEST_ES_SERVER: http://localhost:9250
      PORT: 9250
    strategy:
      fail-fast: false
      matrix:
        ruby: [ '3.2' ]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Increase system limits
      run: |
        sudo swapoff -a
        sudo sysctl -w vm.swappiness=1
        sudo sysctl -w fs.file-max=262144
        sudo sysctl -w vm.max_map_count=262144
    - uses: elastic/elastic-github-actions/elasticsearch@master
      with:
        stack-version: 8.14.0-SNAPSHOT
        security-enabled: false
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
    - name: Build and test with Rake
      run: |
        sudo apt-get update
        sudo apt-get install libcurl4-openssl-dev
        ruby -v
        rake bundle:clean
        rake bundle:install
    - name: elasticsearch
      run: cd elasticsearch && bundle exec rake test:all
