Skip to content

Commit

Permalink
Fix: build OpenSearch with the correct Java/Gradle combination. (#234)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock authored Oct 24, 2024
1 parent 3da6b1d commit 2518f02
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions .github/workflows/test_unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ jobs:
strategy:
fail-fast: false
matrix:
opensearch_ref: [ '1.x', '2.x', 'main' ]
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
Expand All @@ -26,7 +29,7 @@ jobs:
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist
Expand All @@ -35,7 +38,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.opensearch_ref }}
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch

- name: Get OpenSearch branch top
Expand All @@ -50,16 +53,28 @@ jobs:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- uses: actions/setup-java@v4
if: steps.cache-restore.outputs.cache-hit != 'true'
- 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:
distribution: "temurin"
java-version: "21"
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 --warning-mode none
run: ./gradlew :distribution:archives:linux-tar:assemble -Druntime.java=${{ matrix.entry.java }}

- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
Expand All @@ -73,12 +88,12 @@ jobs:
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'
OPENSEARCH_URL: "http://localhost:9200"

0 comments on commit 2518f02

Please sign in to comment.