8000 MINOR add GH action for PR builds (#16895) · Python-Repository-Hub/kafka@3d868aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d868aa

Browse files
authored
MINOR add GH action for PR builds (apache#16895)
For now this will only run on PRs with branch names starting with "gh-" Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
1 parent fd60d2d commit 3d868aa

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/pr.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: pr
17+
18+
on:
19+
pull_request:
20+
types: [opened, synchronize, reopened]
21+
branches: 'gh-*'
22+
23+
jobs:
24+
validate:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
java: [8, 11, 17, 21]
30+
name: Compile and Check Java ${{ matrix.java }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
- name: Setup Java
37+
uses: actions/setup-java@v4
38+
with:
39+
distribution: temurin
40+
java-version: ${{ matrix.java }}
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v4
43+
env:
44+
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
45+
with:
46+
gradle-version: wrapper
47+
# Only write to the cache from trunk
48+
#cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
49+
cache-read-only: false
50+
# Cache downloaded JDKs in addition to the default directories.
51+
gradle-home-cache-includes: |
52+
caches
53+
notifications
54+
jdks
55+
gradle-home-cache-cleanup: true
56+
cache-overwrite-existing: true
57+
- name: Compile and validate
58+
run: ./gradlew --build-cache --info --scan check -x test
59+
60+
test:
61+
needs: validate
62+
runs-on: ubuntu-latest
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
java: [ 11, 17 ]
67+
name: JUnit tests Java ${{ matrix.java }}
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
with:
72+
persist-credentials: false
73+
- name: Setup Java
74+
uses: actions/setup-java@v4
75+
with:
76+
distribution: temurin
77+
java-version: ${{ matrix.java }}
78+
- name: Setup Gradle
79+
uses: gradle/actions/setup-gradle@v4
80+
env:
81+
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
82+
with:
83+
gradle-version: wrapper
84+
# Only write to the cache from trunk
85+
#cache-read-only: ${{ github.ref != 'refs/heads/trunk' }}
86+
cache-read-only: false
87+
# Cache downloaded JDKs in addition to the default directories.
88+
gradle-home-cache-includes: |
89+
caches
90+
notifications
91+
jdks
92+
gradle-home-cache-cleanup: true
93+
cache-overwrite-existing: true
94+
- name: Test
95+
run: |
96+
./gradlew --build-cache --scan --continue \
97+
-PtestLoggingEvents=started,passed,skipped,failed \
98+
-PignoreFailures=true -PmaxParallelForks=2 \
99+
-PmaxTestRetries=1 -PmaxTestRetryFailures=10 \
100+
test

0 commit comments

Comments
 (0)
0