1+ name : " Build Kafka OAuth Binaries"
2+ description : " Build and test kafka-oauth binaries"
3+
4+ inputs :
5+ javaVersion :
6+ description : " Java version"
7+ required : false
8+ default : " 17"
9+ runnerArch :
10+ description : " Architecture of GitHub runner"
11+ required : false
12+ default : " amd64"
13+ mainBuild :
14+ description : " Whether this is the main build"
15+ required : false
16+ default : " false"
17+
18+ runs :
19+ using : " composite"
20+ steps :
21+ - name : Setup Java
22+ uses : strimzi/strimzi-kafka-operator/.github/actions/dependencies/setup-java@main
23+ with :
24+ javaVersion : ${{ inputs.javaVersion }}
25+
26+ - name : Restore Maven cache
27+ uses : actions/cache/restore@v5
28+ with :
29+ path : ~/.m2/repository
30+ key : maven-${{ hashFiles('**/pom.xml') }}
31+ restore-keys : |
32+ maven-
33+
34+ - name : Build & Test Java
35+ shell : bash
36+ run : mvn -e -V -B install
37+ env :
38+ BUILD_REASON : ${{ github.event_name }}
39+ BRANCH : ${{ github.ref }}
40+ TESTCONTAINERS_RYUK_DISABLED : " TRUE"
41+ TESTCONTAINERS_CHECKS_DISABLE : " TRUE"
42+
43+ - name : Run Spotbugs
44+ shell : bash
45+ run : mvn -e -V -B spotbugs:check
46+
47+ - name : Test Docker Examples
48+ shell : bash
49+ run : mvn -e -V -B clean install -f examples/docker --no-transfer-progress
50+
51+ - name : Test Spring Example
52+ shell : bash
53+ run : |
54+ cd examples/docker
55+ ./spring/test-spring.sh
56+
57+ - name : Modify /etc/hosts for tests
58+ shell : bash
59+ run : |
60+ echo "127.0.0.1 keycloak" | sudo tee -a /etc/hosts
61+ echo "127.0.0.1 hydra" | sudo tee -a /etc/hosts
62+ echo "127.0.0.1 hydra-jwt" | sudo tee -a /etc/hosts
63+ echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
64+ echo "127.0.0.1 mockoauth" | sudo tee -a /etc/hosts
65+ echo "127.0.0.1 kerberos" | sudo tee -a /etc/hosts
66+ echo "Modified /etc/hosts:"
67+ cat /etc/hosts
68+
69+ - name : Install Docker Compose
70+ shell : bash
71+ run : |
72+ sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
73+ sudo chmod +x /usr/local/bin/docker-compose
74+
75+ - name : Testsuite Compile & Spotbugs
76+ shell : bash
77+ run : mvn -e -V -B test-compile spotbugs:check -f testsuite
78+
79+ - name : Run Testsuite
80+ shell : bash
81+ run : mvn -e -V -B install -f testsuite --no-transfer-progress
82+
83+ - name : Create tarball with target directory
84+ shell : bash
85+ run : tar -cvpf oauth.tar ./target
86+
87+ - name : Upload binaries artifact
88+ if : ${{ inputs.mainBuild == 'true' }}
89+ uses : actions/upload-artifact@v5
90+ with :
91+ name : oauth.tar
92+ path : oauth.tar
93+
94+ - name : Upload binaries artifact with Java version
95+ uses : actions/upload-artifact@v5
96+ with :
97+ name : oauth-java-${{ inputs.javaVersion }}.tar
98+ path : oauth.tar
99+
100+ - name : Clean external SNAPSHOT dependencies from Maven repository
101+ if : github.ref == 'refs/heads/main'
102+ shell : bash
103+ run : |
104+ mvn dependency:purge-local-repository \
105+ -DsnapshotsOnly=true \
106+ -DreResolve=false || true
107+
108+ - name : Save Maven cache
109+ if : github.ref == 'refs/heads/main' && inputs.mainBuild == 'true'
110+ uses : actions/cache/save@v5
111+ with :
112+ path : ~/.m2/repository
113+ key : maven-${{ hashFiles('**/pom.xml') }}
114+
115+ - name : Publish test results
116+ uses : dorny/test-reporter@v2
117+ if : always()
118+ with :
119+ name : ' Unit & Integration Tests'
120+ path : ' **/TEST-*.xml'
121+ reporter : java-junit
122+ fail-on-error : false
0 commit comments