Skip to content

Updated opensearch-php to reflect the latest OpenSearch API spec #500

Updated opensearch-php to reflect the latest OpenSearch API spec

Updated opensearch-php to reflect the latest OpenSearch API spec #500

name: Integration with Unreleased OpenSearch
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
entry:
- { opensearch_ref: "1.x", java: 11 }
- { opensearch_ref: "2.x", java: 11, gradle-runtime: 17 }
- { opensearch_ref: "main", java: 11, gradle-runtime: 17 }
steps:
- name: Checkout PHP Client
uses: actions/checkout@v4
- name: Use PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
composer install --prefer-dist
- name: Checkout OpenSearch
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch
- name: Get OpenSearch branch top
id: get-key
working-directory: opensearch
run: echo key=`git log -1 --format='%H'` >> $GITHUB_OUTPUT
- name: Restore cached build
id: cache-restore
uses: actions/cache/restore@v4
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.entry.java }}
distribution: temurin
- name: Set up Gradle JDK runtime
if: matrix.entry.gradle-runtime && matrix.entry.gradle-runtime != matrix.entry.java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.entry.gradle-runtime }}
distribution: temurin
- name: Set JAVA${{ matrix.entry.java }}_HOME
shell: bash
run: |
echo "JAVA${{ matrix.entry.java }}_HOME=$JAVA_HOME_${{ matrix.entry.java }}_${{ runner.arch }}" >> $GITHUB_ENV
- name: Assemble OpenSearch
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: opensearch
run: ./gradlew :distribution:archives:linux-tar:assemble -Druntime.java=${{ matrix.entry.java }}
- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}
- name: Run OpenSearch
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
tar xf opensearch-min-*
./opensearch-*/bin/opensearch -d
- name: Wait for Search server
run: php ./.github/wait_for_opensearch.php
- name: Integration tests
run: |
composer run integration-min
env:
OPENSEARCH_URL: "http://localhost:9200"