-
Notifications
You must be signed in to change notification settings - Fork 1.9k
162 lines (158 loc) · 5.71 KB
/
maven.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# This workflow will build a Java project with Maven
# For more information see: https://docs.github.com/actions/automating-builds-and-tests/building-and-testing-java-with-maven
name: build
on:
push:
branches: [ "master", "master-java8", "release-**" ]
pull_request:
branches: [ "master", "master-java8", "release-**" ]
jobs:
verify-format:
runs-on: ubuntu-latest
name: Verify Source Format
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Verify Format and License
run: ./mvnw spotless:check
build:
name: Java ${{ matrix.java }} Maven Test on ${{ matrix.os }}
strategy:
matrix:
java: [ 11.0.x, 17.0.x, 21.0.x ]
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ matrix.java }}-${{ hashFiles('pom.xml', '**/pom.xml') }}
- name: Build with Maven
shell: bash
run: |
if [ $(grep -E '^(8|11)\.' <<< '${{ matrix.java }}') ]; then
# some module doesn't compile on java platform lower than 17, need to skip them by specifying a profile
MODS_OVERRIDES='-pl !spring,!spring-aot'
EXCLUDED_EXAMPLE_MODULES=`ls examples | grep examples | xargs -I {} echo '!examples/{}' | tr '\n' ',' | sed 's/.$//'`
MODS_OVERRIDES=$MODS_OVERRIDES,$EXCLUDED_EXAMPLE_MODULES
fi
./mvnw -q -B --define=org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn $MODS_OVERRIDES clean test
build-graalvm:
runs-on: ubuntu-latest
name: GraalVM Maven Test
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '17'
components: 'native-image'
- name: Build with Maven
run: ./mvnw -q test -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
e2e:
runs-on: ubuntu-latest
name: End-to-End Test Against Real Cluster
steps:
- uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17.0.x
- name: Run E2E with Maven
run: |
./mvnw clean install \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-q \
-Dmaven.test.skip=true
cd e2e
../mvnw test \
-B \
-De2e.skip=false \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
env:
mvnw: ${{ github.workspace }}/mvnw
examples:
runs-on: ubuntu-latest
name: Examples smoke test
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17.0.x
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: |
./mvnw clean install \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-q \
-Dmaven.test.skip=true
- name: Build Cert Manager Contrib
run: |
cd client-java-contrib/cert-manager
../../mvnw clean install \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-q \
-Dmaven.test.skip=true
- name: Build Prometheus Contrib
run: |
cd client-java-contrib/prometheus-operator
../../mvnw clean install \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-q \
-Dmaven.test.skip=true
- name: Examples
run: |
for d in $(find examples* -maxdepth 1 -type d)
do
${MVNW} clean install -Dmaven.test.skip=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
done
env:
MVNW: ${{ github.workspace }}/mvnw
codegen:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
name: CRD Java Models Code Generation
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: kubernetes-client/java/crd-model-gen
tags: gh-action-tmp
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
workdir: client-java-contrib
no_push: true
- name: Run Code-gen for Cert-Manager
working-directory: ${{ github.workspace }}/client-java-contrib/cert-manager
run: IMAGE_TAG=gh-action-tmp ./update.sh
- name: Run Code-gen for Prometheus-Operator
working-directory: ${{ github.workspace }}/client-java-contrib/prometheus-operator
run: IMAGE_TAG=gh-action-tmp ./update.sh