From 577ccc22981f76e73995d8c656ae5d6be2775c5d Mon Sep 17 00:00:00 2001 From: dblock Date: Thu, 24 Oct 2024 10:24:14 -0400 Subject: [PATCH] Fix: build OpenSearch with the correct Java/Gradle combination. Signed-off-by: dblock --- .github/workflows/test_unreleased.yml | 35 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_unreleased.yml b/.github/workflows/test_unreleased.yml index 36b9fc38..c98c4e41 100644 --- a/.github/workflows/test_unreleased.yml +++ b/.github/workflows/test_unreleased.yml @@ -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 @@ -26,7 +29,7 @@ jobs: extensions: yaml, zip, curl env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Install dependencies run: | composer install --prefer-dist @@ -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 @@ -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' @@ -73,7 +88,7 @@ jobs: run: | tar xf opensearch-min-* ./opensearch-*/bin/opensearch -d - + - name: Wait for Search server run: php ./.github/wait_for_opensearch.php @@ -81,4 +96,4 @@ jobs: run: | composer run integration-min env: - OPENSEARCH_URL: 'http://localhost:9200' + OPENSEARCH_URL: "http://localhost:9200"