From f154436c485aacaa87785fe4c5c78820f36ad6a7 Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 12:05:16 -0400 Subject: [PATCH 1/6] GHA renovation * branches (all) * timeout-minutes * checkout version * harmonization across scripts (spacing / wording / labels) * remove chmod for gradlew (unnecessary) Caching tweaks: removed this but I'm unsure: https://github.com/apache/lucene-solr/pull/1910 --- .github/workflows/bin-solr-test.yml | 24 +++++++++--------------- .github/workflows/docker-test.yml | 26 +++++++++----------------- .github/workflows/gradle-precommit.yml | 25 +++++++------------------ .github/workflows/solrj-test.yml | 23 ++++++++--------------- .github/workflows/tests-via-crave.yml | 3 +-- 5 files changed, 34 insertions(+), 67 deletions(-) diff --git a/.github/workflows/bin-solr-test.yml b/.github/workflows/bin-solr-test.yml index 7adb7bfa479..56faf260535 100644 --- a/.github/workflows/bin-solr-test.yml +++ b/.github/workflows/bin-solr-test.yml @@ -3,8 +3,7 @@ name: Solr Script Tests on: pull_request: branches: - - 'main' - - 'branch_*' + - '*' paths: - '.github/workflows/bin-solr-test.yml' - 'solr/bin/**' @@ -17,33 +16,28 @@ jobs: name: Run Solr Script Tests runs-on: ubuntu-latest + timeout-minutes: 15 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - # Setup - - uses: actions/checkout@v4 - - name: Set up JDK + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup JDK uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 java-package: jdk + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - key: ${{ runner.os }}-gradle-binsolr-${{ hashFiles('**/*.lockfile') }} - restore-keys: | - ${{ runner.os }}-gradle-binsolr- - ${{ runner.os }}-gradle- + - name: Test the bin/solr script run: ./gradlew integrationTests + - name: Archive logs if: ${{ failure() }} uses: actions/upload-artifact@v4 diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 268c7572f38..e4b4339598c 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -3,8 +3,7 @@ name: Docker Build & Test on: pull_request: branches: - - 'main' - - 'branch_*' + - '*' paths: - '.github/workflows/docker-test.yml' - 'solr/bin/**' @@ -17,6 +16,7 @@ jobs: name: Build and test Docker image runs-on: ubuntu-latest + timeout-minutes: 15 env: SOLR_DOCKER_IMAGE_REPO: github-pr/solr @@ -24,29 +24,21 @@ jobs: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - # Setup - - uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup JDK uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 java-package: jdk + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Install ACL - run: sudo apt-get install acl - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - key: ${{ runner.os }}-gradle-docker-${{ hashFiles('**/*.lockfile') }} - restore-keys: | - ${{ runner.os }}-gradle-docker- - ${{ runner.os }}-gradle- + - name: Build Docker image with Gradle run: ./gradlew solr:docker:docker + - name: Run tests on Docker image run: ./gradlew solr:docker:testDocker diff --git a/.github/workflows/gradle-precommit.yml b/.github/workflows/gradle-precommit.yml index 1be6bae7c61..268fa2cbadd 100644 --- a/.github/workflows/gradle-precommit.yml +++ b/.github/workflows/gradle-precommit.yml @@ -3,23 +3,23 @@ name: Gradle Precommit on: pull_request: branches: - - 'main' - - 'branch_*' + - '*' jobs: test: name: gradle check runs-on: ubuntu-latest + timeout-minutes: 15 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - # Setup - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Set up JDK + - name: Setup JDK uses: actions/setup-java@v4 with: distribution: 'temurin' @@ -29,19 +29,8 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - key: ${{ runner.os }}-gradle-precommit-${{ hashFiles('**/*.lockfile') }} - restore-keys: | - ${{ runner.os }}-gradle-precommit- - ${{ runner.os }}-gradle- - - name: Run gradle check (without tests) run: ./gradlew check -x test -Ptask.times=true --continue - - uses: gradle/wrapper-validation-action@v3 + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v4 diff --git a/.github/workflows/solrj-test.yml b/.github/workflows/solrj-test.yml index 8842c13d9f1..6bf42505993 100644 --- a/.github/workflows/solrj-test.yml +++ b/.github/workflows/solrj-test.yml @@ -3,8 +3,7 @@ name: SolrJ Tests on: pull_request: branches: - - 'main' - - 'branch_*' + - '*' paths: - '.github/workflows/solrj-test.yml' - 'solr/solrj/**' @@ -14,30 +13,24 @@ jobs: name: Run SolrJ Tests runs-on: ubuntu-latest + timeout-minutes: 15 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} steps: - # Setup - - uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup JDK uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 java-package: jdk + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - key: ${{ runner.os }}-gradle-solrj-${{ hashFiles('**/*.lockfile') }} - restore-keys: | - ${{ runner.os }}-gradle-solrj- - ${{ runner.os }}-gradle- + - name: Test the SolrJ Package run: ./gradlew solr:solrj:test diff --git a/.github/workflows/tests-via-crave.yml b/.github/workflows/tests-via-crave.yml index f9fbc61c9a3..02b0e99660f 100644 --- a/.github/workflows/tests-via-crave.yml +++ b/.github/workflows/tests-via-crave.yml @@ -3,8 +3,7 @@ name: Solr Tests on: pull_request: branches: - - 'main' - - 'branch_*' + - '*' jobs: test: From a24010a0f003de44393fb5c0040c345e9f1d1765 Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 12:30:51 -0400 Subject: [PATCH 2/6] From Lucene: prepare-for-build --- .github/actions/prepare-for-build/action.yml | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/actions/prepare-for-build/action.yml diff --git a/.github/actions/prepare-for-build/action.yml b/.github/actions/prepare-for-build/action.yml new file mode 100644 index 00000000000..c369a67f7ac --- /dev/null +++ b/.github/actions/prepare-for-build/action.yml @@ -0,0 +1,40 @@ +# This composite action is included in other workflows to have a shared setup +# for java, gradle, caches, etc. + +name: Prepare Lucene build +description: Creates a shared setup for other workflows + +inputs: + java-version: + required: false + default: "24" + description: "The default JDK version to set up." + + java-distribution: + required: false + default: "temurin" + description: "The default JDK distribution type" + +runs: + using: "composite" + steps: + - name: Set up Java (${{ inputs.java-distribution }}, ${{ inputs.java-version }})" + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + distribution: ${{ inputs.java-distribution }} + java-version: ${{ inputs.java-version }} + java-package: jdk + + - name: Cache gradle-wrapper.jar + uses: actions/cache@v4 + with: + path: gradle/wrapper/gradle-wrapper.jar + key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.jar.sha256') }} + + # This includes "smart" caching of gradle dependencies. + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + with: + # increase expiry time for the temp. develocity token. + # https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#increasing-the-expiry-time-for-develocity-access-tokens + develocity-token-expiry: 8 From 023046bd7912aa359180ea969473ddbbee64abae Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 12:31:45 -0400 Subject: [PATCH 3/6] format --- .github/actions/prepare-for-build/action.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/actions/prepare-for-build/action.yml b/.github/actions/prepare-for-build/action.yml index c369a67f7ac..a7b16653ff5 100644 --- a/.github/actions/prepare-for-build/action.yml +++ b/.github/actions/prepare-for-build/action.yml @@ -5,19 +5,19 @@ name: Prepare Lucene build description: Creates a shared setup for other workflows inputs: - java-version: - required: false - default: "24" - description: "The default JDK version to set up." + java-version: + required: false + default: "24" + description: "The default JDK version to set up." - java-distribution: - required: false - default: "temurin" - description: "The default JDK distribution type" + java-distribution: + required: false + default: "temurin" + description: "The default JDK distribution type" runs: - using: "composite" - steps: + using: "composite" + steps: - name: Set up Java (${{ inputs.java-distribution }}, ${{ inputs.java-version }})" uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 with: From a9c9c8a51f072c6498c883d2dfecd1b8aafc2a4a Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 12:32:34 -0400 Subject: [PATCH 4/6] Change for Solr --- .github/actions/prepare-for-build/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/prepare-for-build/action.yml b/.github/actions/prepare-for-build/action.yml index a7b16653ff5..4000a7c0d2a 100644 --- a/.github/actions/prepare-for-build/action.yml +++ b/.github/actions/prepare-for-build/action.yml @@ -1,13 +1,13 @@ # This composite action is included in other workflows to have a shared setup # for java, gradle, caches, etc. -name: Prepare Lucene build +name: Prepare build description: Creates a shared setup for other workflows inputs: java-version: required: false - default: "24" + default: "21" description: "The default JDK version to set up." java-distribution: From 6ee746b4154f438020bff80987608ffa574a834b Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 12:51:00 -0400 Subject: [PATCH 5/6] Refactor workflows to use our prepare-for-build --- .github/workflows/bin-solr-test.yml | 10 +--------- .github/workflows/docker-test.yml | 10 +--------- .github/workflows/gradle-precommit.yml | 10 +--------- .github/workflows/solrj-test.yml | 10 +--------- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/.github/workflows/bin-solr-test.yml b/.github/workflows/bin-solr-test.yml index 56faf260535..132ff372470 100644 --- a/.github/workflows/bin-solr-test.yml +++ b/.github/workflows/bin-solr-test.yml @@ -25,15 +25,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Setup JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - java-package: jdk - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + - uses: ./.github/actions/prepare-for-build - name: Test the bin/solr script run: ./gradlew integrationTests diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index e4b4339598c..df28c0b1df1 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -27,15 +27,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Setup JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - java-package: jdk - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + - uses: ./.github/actions/prepare-for-build - name: Build Docker image with Gradle run: ./gradlew solr:docker:docker diff --git a/.github/workflows/gradle-precommit.yml b/.github/workflows/gradle-precommit.yml index 268fa2cbadd..25cb959bee8 100644 --- a/.github/workflows/gradle-precommit.yml +++ b/.github/workflows/gradle-precommit.yml @@ -19,15 +19,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Setup JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - java-package: jdk - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + - uses: ./.github/actions/prepare-for-build - name: Run gradle check (without tests) run: ./gradlew check -x test -Ptask.times=true --continue diff --git a/.github/workflows/solrj-test.yml b/.github/workflows/solrj-test.yml index 6bf42505993..ec8f8c7034f 100644 --- a/.github/workflows/solrj-test.yml +++ b/.github/workflows/solrj-test.yml @@ -22,15 +22,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Setup JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - java-package: jdk - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + - uses: ./.github/actions/prepare-for-build - name: Test the SolrJ Package run: ./gradlew solr:solrj:test From 80f54368dc9b8b6081699134b29792df8ada484e Mon Sep 17 00:00:00 2001 From: David Smiley Date: Thu, 19 Jun 2025 18:34:38 -0400 Subject: [PATCH 6/6] More time (40m) for solr/bin integrationTests --- .github/workflows/bin-solr-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bin-solr-test.yml b/.github/workflows/bin-solr-test.yml index 132ff372470..2eeb426dbee 100644 --- a/.github/workflows/bin-solr-test.yml +++ b/.github/workflows/bin-solr-test.yml @@ -16,7 +16,7 @@ jobs: name: Run Solr Script Tests runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 40 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}