-
-
Notifications
You must be signed in to change notification settings - Fork 13
130 lines (110 loc) · 4.93 KB
/
Copy pathmaven.yaml
File metadata and controls
130 lines (110 loc) · 4.93 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#
# 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: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Test for Sonar secret'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
echo "SONAR_TOKEN_SET=$(test ${SONAR_TOKEN} && echo true)" >> $GITHUB_ENV
- name: 'Check out repository'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
submodules: 'true'
fetch-depth: 0
- name: 'Set up Java'
uses: ./.github/actions/common/setup-java
- name: 'Cache Maven packages'
uses: ./.github/actions/common/cache-maven-packages
- name: Cache SonarCloud packages
uses: ./.github/actions/common/cache-sonar-packages
- name: 'Build junit extension with maven tests'
if: github.ref_name != 'main' || env.SONAR_TOKEN_SET != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B clean verify -Pci
- name: 'Build junit extension maven project on main'
if: github.event_name == 'push' && github.ref_name == 'main' && env.SONAR_TOKEN_SET == 'true'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B clean verify -Pci org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar -Dsonar.projectKey=kroxylicious_kroxylicious-junit5-extension
- name: 'Run tests in containers'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: TEST_CLUSTER_EXECUTION_MODE=CONTAINER KAFKA_VERSION=latest mvn -B clean verify -Dsurefire.failIfNoSpecifiedTests=false -Dtest=KafkaClusterTest
- name: Save PR number to file
if: ${{ github.event_name == 'pull_request' }}
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: PR_NUMBER
path: PR_NUMBER.txt
- name: Archive container logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: ${{ failure() }}
with:
name: container-logs
path: "**/container-logs/**/*.log"
older_kafka_matrix:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
version: [3.8.0,3.9.0,4.0.0,4.1.0,4.2.0,4.3.1]
steps:
- name: 'Check out repository'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
submodules: 'true'
fetch-depth: 0
- name: 'Set up Java'
uses: ./.github/actions/common/setup-java
- name: 'Cache Maven packages'
uses: ./.github/actions/common/cache-maven-packages
- name: 'Install junit extension'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B install -DskipTests=true
- name: 'Run select junit tests (Kafka in-VM)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Note - the extension won't necessarily compile against the earlier versions of Kafka.
# We want to run the tests against the code that was compiled in the install step, just with
# a different version of Kafka on the classpath.
run: mvn -Dmaven.main.skip=true -Dmaven.javadoc.skip=true -pl impl,junit5-extension -B test -Dtest=KafkaClusterTest,ParameterExtensionTest -Dkafka.version=${{ matrix.version }}
- name: 'Run select junit tests (Kafka containers)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The annotations don't respect env var TEST_CLUSTER_EXECUTION_MODE, so running ParameterExtensionTest is pointless.
run: TEST_CLUSTER_EXECUTION_MODE=CONTAINER mvn -Dmaven.main.skip=true -Dmaven.javadoc.skip=true -pl impl -B test -Dtest=KafkaClusterTest -Dkafka.version=${{ matrix.version }}
- name: Archive container logs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: ${{ failure() }}
with:
name: container-logs
path: "**/container-logs/**/*.log"