Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds newer OpenSearch builds to integration tests and updates unreleased to use new caching mechanism #143

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
39 changes: 22 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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: |
Expand Down
58 changes: 38 additions & 20 deletions .github/workflows/test_unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,58 @@ 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 }}

- uses: actions/setup-java@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think setting up java is needed here.

with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '11'

- 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 }}
Expand All @@ -53,9 +74,6 @@ jobs:
run: |
composer install --prefer-dist

- name: Wait for Search server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave the wait for server script so that cluster is available when the integration tests run.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea maybe it is the wait for script for the cluster error

run: php ./.github/wait_for_es.php

- name: Integration tests
run: |
composer run integration
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down