You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2024/08/20 22:39:47 UTC
(kafka) branch trunk updated: MINOR: Separate GH workflows for PRs and trunk (#16936)
This is an automated email from the ASF dual-hosted git repository.
davidarthur pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 70952804958 MINOR: Separate GH workflows for PRs and trunk (#16936)
70952804958 is described below
commit 7095280495831bf7e6b2951209829ec719844ec3
Author: David Arthur <mu...@gmail.com>
AuthorDate: Tue Aug 20 18:39:42 2024 -0400
MINOR: Separate GH workflows for PRs and trunk (#16936)
This patch creates separate GitHub Actions workflows for trunk and for pull requests.
On trunk, each commit will be built separately and the build scan will be uploaded to ge.apache.org. The trunk builds will also populate a Gradle cache managed by Github Actions.
Pull Requests will be built on each commit, but will interrupt an ongoing build (for the same PR). These builds will not populate the Gradle cache and will not upload the build scan unless the PRs are in apache/kafka.
For now, only pull requests with branches named like "gh-*" will run the junit tests. This is to allow developers to opt-in to the GH build.
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
.github/actions/setup-gradle/action.yml | 52 ++++++++++++++++++++++++++++
.github/workflows/{pr.yml => ci.yml} | 60 +++++++++------------------------
.github/workflows/pr.yml | 60 ++++++++++-----------------------
3 files changed, 84 insertions(+), 88 deletions(-)
diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml
new file mode 100644
index 00000000000..9ffdcac6a7f
--- /dev/null
+++ b/.github/actions/setup-gradle/action.yml
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: "Gradle Setup"
+description: "Setup Java and Gradle"
+inputs:
+ java-version:
+ description: "Java version to use"
+ default: "17"
+ gradle-cache-read-only:
+ description: "Should the Gradle cache be read-only?"
+ default: "true"
+ develocity-access-key:
+ description: "Optional access key for uploading build scans to Develocity"
+ default: ""
+runs:
+ using: "composite"
+ steps:
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: ${{ inputs.java-version }}
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+ env:
+ GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+ with:
+ gradle-version: wrapper
+ develocity-access-key: ${{ inputs.develocity-access-key }}
+ cache-read-only: ${{ inputs.gradle-cache-read-only }}
+ # Cache downloaded JDKs in addition to the default directories.
+ gradle-home-cache-includes: |
+ caches
+ notifications
+ jdks
+ cache-cleanup: on-success
diff --git a/.github/workflows/pr.yml b/.github/workflows/ci.yml
similarity index 57%
copy from .github/workflows/pr.yml
copy to .github/workflows/ci.yml
index 1ebb1a12c80..834b090315f 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/ci.yml
@@ -13,15 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-name: Pull Requests
+name: CI
on:
push:
- branches: 'gh-*'
+ branches:
+ - 'trunk'
- pull_request:
- types: [opened, synchronize, reopened]
- branches: 'gh-*'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: false # Let each trunk commit finish a build
jobs:
validate:
@@ -29,35 +30,19 @@ jobs:
strategy:
fail-fast: false
matrix:
- java: [8, 21]
+ java: [8, 11, 17, 21]
name: Compile and Check Java ${{ matrix.java }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- - name: Setup Java
- uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: ${{ matrix.java }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v4
- env:
- GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+ uses: ./.github/actions/setup-gradle
with:
- gradle-version: wrapper
+ java-version: ${{ matrix.java }}
+ gradle-cache-read-only: false
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- # Only write to the cache from trunk
- #cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
- cache-read-only: false
- # Cache downloaded JDKs in addition to the default directories.
- gradle-home-cache-includes: |
- caches
- notifications
- jdks
- cache-cleanup: on-success
- cache-overwrite-existing: true
- name: Compile and validate
run: ./gradlew --build-cache --info --scan check -x test
@@ -74,32 +59,17 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
- - name: Setup Java
- uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: ${{ matrix.java }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v4
- env:
- GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+ uses: ./.github/actions/setup-gradle
with:
- gradle-version: wrapper
+ java-version: ${{ matrix.java }}
+ gradle-cache-read-only: false
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- # Only write to the cache from trunk
- #cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
- cache-read-only: false
- # Cache downloaded JDKs in addition to the default directories.
- gradle-home-cache-includes: |
- caches
- notifications
- jdks
- cache-cleanup: on-success
- cache-overwrite-existing: true
- name: Test
+ timeout-minutes: 180 # 3 hours
run: |
./gradlew --build-cache --scan --continue \
-PtestLoggingEvents=started,passed,skipped,failed \
-PignoreFailures=true -PmaxParallelForks=2 \
-PmaxTestRetries=1 -PmaxTestRetryFailures=10 \
- test
+ test
\ No newline at end of file
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 1ebb1a12c80..7f22a2fa5da 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -16,12 +16,14 @@
name: Pull Requests
on:
- push:
- branches: 'gh-*'
-
pull_request:
types: [opened, synchronize, reopened]
- branches: 'gh-*'
+ branches:
+ - 'trunk'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
jobs:
validate:
@@ -29,36 +31,21 @@ jobs:
strategy:
fail-fast: false
matrix:
- java: [8, 21]
+ java: [ 8, 11, 17, 21 ]
name: Compile and Check Java ${{ matrix.java }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- - name: Setup Java
- uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: ${{ matrix.java }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v4
- env:
- GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+ uses: ./.github/actions/setup-gradle
with:
- gradle-version: wrapper
+ java-version: ${{ matrix.java }}
+ gradle-cache-read-only: true
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- # Only write to the cache from trunk
- #cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
- cache-read-only: false
- # Cache downloaded JDKs in addition to the default directories.
- gradle-home-cache-includes: |
- caches
- notifications
- jdks
- cache-cleanup: on-success
- cache-overwrite-existing: true
- name: Compile and validate
+ # Publish build scans for now. This will only work on PRs from apache/kafka, not public forks.
run: ./gradlew --build-cache --info --scan check -x test
test:
@@ -68,35 +55,22 @@ jobs:
fail-fast: false
matrix:
java: [ 11, 17 ]
+ if: contains(github.head_ref, 'gh-') # For now, only run tests on "gh-*" PRs
name: JUnit tests Java ${{ matrix.java }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- - name: Setup Java
- uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: ${{ matrix.java }}
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v4
- env:
- GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+ uses: ./.github/actions/setup-gradle
with:
- gradle-version: wrapper
+ java-version: ${{ matrix.java }}
+ gradle-cache-read-only: true
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- # Only write to the cache from trunk
- #cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
- cache-read-only: false
- # Cache downloaded JDKs in addition to the default directories.
- gradle-home-cache-includes: |
- caches
- notifications
- jdks
- cache-cleanup: on-success
- cache-overwrite-existing: true
- name: Test
+ # Publish build scans for now. This will only work on PRs from apache/kafka, not public forks.
+ timeout-minutes: 180 # 3 hours
run: |
./gradlew --build-cache --scan --continue \
-PtestLoggingEvents=started,passed,skipped,failed \