Skip to content

Commit 40c58fe

Browse files
authored
GHA renovation (#3396)
* GHA renovation * branches (all) * timeout-minutes * checkout version * harmonization across scripts (spacing / wording / labels) * remove chmod for gradlew (unnecessary) * From Lucene: prepare-for-build * Refactor workflows to use our prepare-for-build
1 parent a1ebd04 commit 40c58fe

File tree

6 files changed

+72
-97
lines changed

6 files changed

+72
-97
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This composite action is included in other workflows to have a shared setup
2+
# for java, gradle, caches, etc.
3+
4+
name: Prepare build
5+
description: Creates a shared setup for other workflows
6+
7+
inputs:
8+
java-version:
9+
required: false
10+
default: "21"
11+
description: "The default JDK version to set up."
12+
13+
java-distribution:
14+
required: false
15+
default: "temurin"
16+
description: "The default JDK distribution type"
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Set up Java (${{ inputs.java-distribution }}, ${{ inputs.java-version }})"
22+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
23+
with:
24+
distribution: ${{ inputs.java-distribution }}
25+
java-version: ${{ inputs.java-version }}
26+
java-package: jdk
27+
28+
- name: Cache gradle-wrapper.jar
29+
uses: actions/cache@v4
30+
with:
31+
path: gradle/wrapper/gradle-wrapper.jar
32+
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.jar.sha256') }}
33+
34+
# This includes "smart" caching of gradle dependencies.
35+
- name: Set up Gradle
36+
uses: gradle/actions/setup-gradle@v4
37+
with:
38+
# increase expiry time for the temp. develocity token.
39+
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#increasing-the-expiry-time-for-develocity-access-tokens
40+
develocity-token-expiry: 8

.github/workflows/bin-solr-test.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Solr Script Tests
33
on:
44
pull_request:
55
branches:
6-
- 'main'
7-
- 'branch_*'
6+
- '*'
87
paths:
98
- '.github/workflows/bin-solr-test.yml'
109
- 'solr/bin/**'
@@ -17,33 +16,20 @@ jobs:
1716
name: Run Solr Script Tests
1817

1918
runs-on: ubuntu-latest
19+
timeout-minutes: 40
2020

2121
env:
2222
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2323

2424
steps:
25-
# Setup
26-
- uses: actions/checkout@v4
27-
- name: Set up JDK
28-
uses: actions/setup-java@v4
29-
with:
30-
distribution: 'temurin'
31-
java-version: 21
32-
java-package: jdk
33-
- name: Setup Gradle
34-
uses: gradle/actions/setup-gradle@v4
35-
- name: Grant execute permission for gradlew
36-
run: chmod +x gradlew
37-
- uses: actions/cache@v4
38-
with:
39-
path: |
40-
~/.gradle/caches
41-
key: ${{ runner.os }}-gradle-binsolr-${{ hashFiles('**/*.lockfile') }}
42-
restore-keys: |
43-
${{ runner.os }}-gradle-binsolr-
44-
${{ runner.os }}-gradle-
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- uses: ./.github/actions/prepare-for-build
29+
4530
- name: Test the bin/solr script
4631
run: ./gradlew integrationTests
32+
4733
- name: Archive logs
4834
if: ${{ failure() }}
4935
uses: actions/upload-artifact@v4

.github/workflows/docker-test.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Docker Build & Test
33
on:
44
pull_request:
55
branches:
6-
- 'main'
7-
- 'branch_*'
6+
- '*'
87
paths:
98
- '.github/workflows/docker-test.yml'
109
- 'solr/bin/**'
@@ -17,36 +16,21 @@ jobs:
1716
name: Build and test Docker image
1817

1918
runs-on: ubuntu-latest
19+
timeout-minutes: 15
2020

2121
env:
2222
SOLR_DOCKER_IMAGE_REPO: github-pr/solr
2323
SOLR_DOCKER_IMAGE_TAG: ${{github.event.number}}
2424
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2525

2626
steps:
27-
# Setup
28-
- uses: actions/checkout@v4
29-
- name: Set up JDK 21
30-
uses: actions/setup-java@v4
31-
with:
32-
distribution: 'temurin'
33-
java-version: 21
34-
java-package: jdk
35-
- name: Setup Gradle
36-
uses: gradle/actions/setup-gradle@v4
37-
- name: Install ACL
38-
run: sudo apt-get install acl
39-
- name: Grant execute permission for gradlew
40-
run: chmod +x gradlew
41-
- uses: actions/cache@v4
42-
with:
43-
path: |
44-
~/.gradle/caches
45-
key: ${{ runner.os }}-gradle-docker-${{ hashFiles('**/*.lockfile') }}
46-
restore-keys: |
47-
${{ runner.os }}-gradle-docker-
48-
${{ runner.os }}-gradle-
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- uses: ./.github/actions/prepare-for-build
31+
4932
- name: Build Docker image with Gradle
5033
run: ./gradlew solr:docker:docker
34+
5135
- name: Run tests on Docker image
5236
run: ./gradlew solr:docker:testDocker

.github/workflows/gradle-precommit.yml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,26 @@ name: Gradle Precommit
33
on:
44
pull_request:
55
branches:
6-
- 'main'
7-
- 'branch_*'
6+
- '*'
87

98
jobs:
109
test:
1110
name: gradle check
1211

1312
runs-on: ubuntu-latest
13+
timeout-minutes: 15
1414

1515
env:
1616
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
1717

1818
steps:
19-
# Setup
20-
- uses: actions/checkout@v4
21-
22-
- name: Set up JDK
23-
uses: actions/setup-java@v4
24-
with:
25-
distribution: 'temurin'
26-
java-version: 21
27-
java-package: jdk
28-
29-
- name: Setup Gradle
30-
uses: gradle/actions/setup-gradle@v4
31-
32-
- name: Grant execute permission for gradlew
33-
run: chmod +x gradlew
34-
35-
- uses: actions/cache@v4
36-
with:
37-
path: |
38-
~/.gradle/caches
39-
key: ${{ runner.os }}-gradle-precommit-${{ hashFiles('**/*.lockfile') }}
40-
restore-keys: |
41-
${{ runner.os }}-gradle-precommit-
42-
${{ runner.os }}-gradle-
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- uses: ./.github/actions/prepare-for-build
4323

4424
- name: Run gradle check (without tests)
4525
run: ./gradlew check -x test -Ptask.times=true --continue
4626

47-
- uses: gradle/wrapper-validation-action@v3
27+
- name: Validate Gradle wrapper
28+
uses: gradle/actions/wrapper-validation@v4

.github/workflows/solrj-test.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: SolrJ Tests
33
on:
44
pull_request:
55
branches:
6-
- 'main'
7-
- 'branch_*'
6+
- '*'
87
paths:
98
- '.github/workflows/solrj-test.yml'
109
- 'solr/solrj/**'
@@ -14,30 +13,16 @@ jobs:
1413
name: Run SolrJ Tests
1514

1615
runs-on: ubuntu-latest
16+
timeout-minutes: 15
1717

1818
env:
1919
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2020

2121
steps:
22-
# Setup
23-
- uses: actions/checkout@v4
24-
- name: Set up JDK 21
25-
uses: actions/setup-java@v4
26-
with:
27-
distribution: 'temurin'
28-
java-version: 21
29-
java-package: jdk
30-
- name: Setup Gradle
31-
uses: gradle/actions/setup-gradle@v4
32-
- name: Grant execute permission for gradlew
33-
run: chmod +x gradlew
34-
- uses: actions/cache@v4
35-
with:
36-
path: |
37-
~/.gradle/caches
38-
key: ${{ runner.os }}-gradle-solrj-${{ hashFiles('**/*.lockfile') }}
39-
restore-keys: |
40-
${{ runner.os }}-gradle-solrj-
41-
${{ runner.os }}-gradle-
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- uses: ./.github/actions/prepare-for-build
26+
4227
- name: Test the SolrJ Package
4328
run: ./gradlew solr:solrj:test

.github/workflows/tests-via-crave.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Solr Tests
33
on:
44
pull_request:
55
branches:
6-
- 'main'
7-
- 'branch_*'
6+
- '*'
87

98
jobs:
109
test:

0 commit comments

Comments
 (0)