diff --git a/.github/wait_for_es.php b/.github/wait_for_opensearch.php similarity index 100% rename from .github/wait_for_es.php rename to .github/wait_for_opensearch.php diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7e972e07..2fd04aba2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: yaml, zip, curl env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -35,12 +35,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: yaml, zip, curl env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest services: search-server: - image: opensearchproject/opensearch:2.2.1 + image: opensearchproject/opensearch:2.6.0 ports: - 9200:9200 env: @@ -67,12 +67,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: yaml, zip, curl, pcov env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -82,7 +82,7 @@ jobs: composer install --prefer-dist - name: Wait for Search server - run: php ./.github/wait_for_es.php + run: php ./.github/wait_for_opensearch.php - name: PHPUnit run: | @@ -112,7 +112,7 @@ jobs: - windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 @@ -142,9 +142,14 @@ jobs: - docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0 - opensearchproject/opensearch:1.1.0 - opensearchproject/opensearch:1.2.4 - - opensearchproject/opensearch:1.3.6 + - opensearchproject/opensearch:1.3.9 + - opensearchproject/opensearch:2.0.1 - opensearchproject/opensearch:2.1.0 - opensearchproject/opensearch:2.2.1 + - opensearchproject/opensearch:2.3.0 + - opensearchproject/opensearch:2.4.1 + - opensearchproject/opensearch:2.5.0 + - opensearchproject/opensearch:2.6.0 services: search-server: image: ${{ matrix.search-server-image }} @@ -156,12 +161,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: yaml, zip, curl env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -171,7 +176,7 @@ jobs: composer install --prefer-dist - name: Wait for Search server - run: php ./.github/wait_for_es.php + run: php ./.github/wait_for_opensearch.php - name: Integration tests run: | diff --git a/.github/workflows/test_unreleased.yml b/.github/workflows/test_unreleased.yml index 43dfb6433..a1f5697af 100644 --- a/.github/workflows/test_unreleased.yml +++ b/.github/workflows/test_unreleased.yml @@ -14,37 +14,53 @@ jobs: strategy: fail-fast: false matrix: - entry: - - { opensearch_ref: '1.x' } - - { opensearch_ref: '2.0' } - - { opensearch_ref: '2.x' } - - { opensearch_ref: 'main' } + opensearch_ref: [ '1.x', '2.x', '2.0', 'main' ] steps: - name: Checkout OpenSearch - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: opensearch-project/OpenSearch - ref: ${{ matrix.entry.opensearch_ref }} + ref: ${{ matrix.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@v3 + with: + path: opensearch/distribution/archives/linux-tar/build/distributions + key: ${{ steps.get-key.outputs.key }} + - name: Assemble OpenSearch + if: steps.cache-restore.outputs.cache-hit != 'true' + working-directory: opensearch + run: ./gradlew :distribution:archives:linux-tar:assemble + + - name: Save cached build + if: steps.cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + 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: | - cd opensearch - ./gradlew assemble - # This step runs the docker image generated during gradle assemble in OpenSearch. It is tagged as opensearch:test. - # Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190 - - name: Run Docker Image - run: | - docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test - sleep 90 + tar xf opensearch-min-* + ./opensearch-*/bin/opensearch & + for attempt in {1..20}; do sleep 5; if curl -s localhost:9200; then echo '=====> ready'; break; fi; echo '=====> waiting...'; done - name: Checkout PHP Client uses: actions/checkout@v2 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 extensions: yaml, zip, curl env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -54,7 +70,8 @@ jobs: composer install --prefer-dist - name: Wait for Search server - run: php ./.github/wait_for_es.php + run: php ./.github/wait_for_opensearch.php + - name: Integration tests run: | diff --git a/.github/workflows/update_docs.yml b/.github/workflows/update_docs.yml index 623465e20..be4aaca6c 100644 --- a/.github/workflows/update_docs.yml +++ b/.github/workflows/update_docs.yml @@ -25,10 +25,10 @@ jobs: with: fetch-depth: 0 - - name: Use PHP 8.1 + - name: Use PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}