forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (101 loc) · 3.86 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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: Pull Requests
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- 'trunk'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 21, 17, 11, 8 ]
name: Compile and Check Java ${{ matrix.java }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup Gradle
uses: ./.github/actions/setup-gradle
with:
java-version: ${{ matrix.java }}
gradle-cache-read-only: true
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Compile and validate
# Gradle flags
# --build-cache: Let Gradle restore the build cache
# --info: For now, we'll generate lots of logs while setting up the GH Actions
# --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks.
run: ./gradlew --build-cache --info --scan check -x test
- name: Archive check reports
if: always()
uses: actions/upload-artifact@v4
with:
name: check-reports-${{ matrix.java }}
path: |
**/build/**/*.html
if-no-files-found: ignore
- name: Annotate checkstyle errors
# Avoid duplicate annotations, only run on java 21
# For now, limit to "gh-" PRs
if: ${{ contains(github.head_ref, 'gh-') && failure() && matrix.java == '21' }}
run: python .github/scripts/checkstyle.py
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
test:
needs: validate
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 17, 11 ]
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 Gradle
<<<<<<< HEAD
uses: ./.github/actions/setup-gradle
=======
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
env:
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
>>>>>>> a785503db5 (KAFKA-17193: Pin all external GitHub Actions to the specific git hash)
with:
java-version: ${{ matrix.java }}
gradle-cache-read-only: true
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
- 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 \
-PignoreFailures=true -PmaxParallelForks=2 \
-PmaxTestRetries=1 -PmaxTestRetryFailures=10 \
test