Skip to content

Commit

Permalink
Fix: build OpenSearch with the correct Java/Gradle combination.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Oct 24, 2024
1 parent 3da6b1d commit 43abe11
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 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: 21 }
- { opensearch_ref: "main", java: 21 }
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,22 @@ 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 Gradle JDK runtime
if: matrix.entry.gradle-runtime
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.java }} --warning-mode none

- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
Expand All @@ -73,7 +82,7 @@ jobs:
run: |
tar xf opensearch-min-*
./opensearch-*/bin/opensearch -d
- name: Wait for Search server
run: php ./.github/wait_for_opensearch.php

Expand Down

0 comments on commit 43abe11

Please sign in to comment.