Skip to content

Commit a2977ad

Browse files
committed
feat(build): split ITs by category, parallel CRD generation
Also avoid generating CRDs when not needed using no-apt profile Signed-off-by: Chris Laprun <claprun@redhat.com>
1 parent 3dd77c1 commit a2977ad

File tree

7 files changed

+184
-88
lines changed

7 files changed

+184
-88
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build
2+
3+
env:
4+
MAVEN_ARGS: -V -ntp -e
5+
6+
on:
7+
workflow_call:
8+
9+
jobs:
10+
integration_tests:
11+
strategy:
12+
matrix:
13+
java: [ 17, 21 ]
14+
kubernetes: [ 'v1.28.14', 'v1.29.9','1.30.5', '1.31.1' ]
15+
it-category: [ baseapi, dependent, workflow ]
16+
uses: ./.github/workflows/integration-tests.yml
17+
with:
18+
java-version: ${{ matrix.java }}
19+
kube-version: ${{ matrix.kubernetes }}
20+
it-category: ${{ matrix.it-category }}
21+
22+
httpclient-tests:
23+
strategy:
24+
matrix:
25+
httpclient: [ 'vertx', 'jdk', 'jetty' ]
26+
uses: ./.github/workflows/integration-tests.yml
27+
with:
28+
java-version: 17
29+
kube-version: 'v1.30.5'
30+
http-client: ${{ matrix.httpclient }}
31+
experimental: true
32+
33+
special_integration_tests:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
java: [ 17, 21 ]
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Set up Java and Maven
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: temurin
44+
java-version: ${{ matrix.java }}
45+
- name: Run Special Integration Tests
46+
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml

.github/workflows/fabric8-next-version-schedule.yml

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,8 @@ jobs:
2323
with:
2424
distribution: temurin
2525
java-version: 17
26-
cache: 'maven'
2726
- name: Run unit tests
2827
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
2928

30-
integration_tests:
31-
strategy:
32-
matrix:
33-
java: [ 11, 17 ]
34-
kubernetes: ['v1.28.12', 'v1.29.7','1.30.3', '1.31.0']
35-
uses: ./.github/workflows/integration-tests.yml
36-
with:
37-
java-version: ${{ matrix.java }}
38-
kube-version: ${{ matrix.kubernetes }}
39-
40-
httpclient-tests:
41-
strategy:
42-
matrix:
43-
httpclient: [ 'vertx', 'jdk', 'jetty' ]
44-
uses: ./.github/workflows/integration-tests.yml
45-
with:
46-
java-version: 17
47-
kube-version: 'v1.29.1'
48-
http-client: ${{ matrix.httpclient }}
49-
experimental: true
50-
checkout-ref: 'fabric8-next-version'
51-
52-
special_integration_tests:
53-
runs-on: ubuntu-latest
54-
strategy:
55-
matrix:
56-
java: [ 11, 17 ]
57-
steps:
58-
- uses: actions/checkout@v4
59-
with:
60-
ref: 'fabric8-next-version'
61-
- name: Set up Java and Maven
62-
uses: actions/setup-java@v4
63-
with:
64-
distribution: temurin
65-
java-version: ${{ matrix.java }}
66-
cache: 'maven'
67-
- name: Run Special Integration Tests
68-
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
29+
build:
30+
uses: ./.github/workflows/build.yml

.github/workflows/integration-tests.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
type: string
2222
required: false
2323
default: ''
24+
it-category:
25+
type: string
26+
required: false
27+
default: ''
2428

2529
jobs:
2630
integration_tests:
@@ -42,9 +46,17 @@ jobs:
4246
- name: Set up Minikube
4347
uses: manusa/actions-setup-minikube@v2.12.0
4448
with:
45-
minikube version: v1.33.0
46-
kubernetes version: ${{ inputs.kube-version }}
49+
minikube version: 'v1.33.0'
50+
kubernetes version: '${{ inputs.kube-version }}'
4751
driver: 'docker'
4852
github token: ${{ secrets.GITHUB_TOKEN }}
49-
- name: Run integration tests
50-
run: ./mvnw ${MAVEN_ARGS} -B package -P no-unit-tests -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml
53+
- name: "${{inputs.it-category}} integration tests (kube: ${{ inputs.kube-version }} / java: ${{ inputs.java-version }} / client: ${{ inputs.http-client }}"
54+
run: |
55+
if [ -z "${{inputs.it-category}}" ]; then
56+
it_profile="integration-tests"
57+
else
58+
it_profile="integration-tests-${{inputs.it-category}}"
59+
fi
60+
echo "Using profile: ${it_profile}"
61+
./mvnw ${MAVEN_ARGS} -B install -DskipTests -Pno-apt --file pom.xml
62+
./mvnw ${MAVEN_ARGS} -B package -T1C -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml

.github/workflows/pr.yml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,7 @@ jobs:
2828
run: |
2929
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml
3030
- name: Run unit tests
31-
run: ./mvnw ${MAVEN_ARGS} clean install --file pom.xml
31+
run: ./mvnw ${MAVEN_ARGS} clean install -Pno-apt --file pom.xml
3232

33-
integration_tests:
34-
strategy:
35-
matrix:
36-
java: [ 17, 21 ]
37-
kubernetes: [ 'v1.28.12', 'v1.29.7','1.30.3', '1.31.0' ]
38-
uses: ./.github/workflows/integration-tests.yml
39-
with:
40-
java-version: ${{ matrix.java }}
41-
kube-version: ${{ matrix.kubernetes }}
42-
43-
httpclient-tests:
44-
strategy:
45-
matrix:
46-
httpclient: [ 'vertx', 'jdk', 'jetty' ]
47-
uses: ./.github/workflows/integration-tests.yml
48-
with:
49-
java-version: 17
50-
kube-version: 'v1.29.1'
51-
http-client: ${{ matrix.httpclient }}
52-
experimental: true
53-
54-
special_integration_tests:
55-
runs-on: ubuntu-latest
56-
strategy:
57-
matrix:
58-
java: [ 17, 21 ]
59-
steps:
60-
- uses: actions/checkout@v4
61-
- name: Set up Java and Maven
62-
uses: actions/setup-java@v4
63-
with:
64-
distribution: temurin
65-
java-version: ${{ matrix.java }}
66-
cache: 'maven'
67-
- name: Run Special Integration Tests
68-
run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml
33+
build:
34+
uses: ./.github/workflows/build.yml

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/workflow/WorkflowReconcileExecutorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import org.assertj.core.api.Assertions;
77
import org.junit.jupiter.api.BeforeEach;
88
import org.junit.jupiter.api.Test;
9+
import org.junit.jupiter.api.TestInfo;
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
912

1013
import io.fabric8.kubernetes.api.model.ConfigMap;
1114
import io.fabric8.kubernetes.api.model.HasMetadata;
@@ -20,6 +23,7 @@
2023
import static org.mockito.Mockito.*;
2124

2225
class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {
26+
private static final Logger log = LoggerFactory.getLogger(WorkflowReconcileExecutorTest.class);
2327

2428
@SuppressWarnings("unchecked")
2529
Context<TestCustomResource> mockContext = mock(Context.class);
@@ -30,7 +34,8 @@ class WorkflowReconcileExecutorTest extends AbstractWorkflowExecutorTest {
3034

3135
@BeforeEach
3236
@SuppressWarnings("unchecked")
33-
void setup() {
37+
void setup(TestInfo testInfo) {
38+
log.debug("==> Starting test {}", testInfo.getDisplayName());
3439
when(mockContext.getWorkflowExecutorService()).thenReturn(executorService);
3540
when(mockContext.eventSourceRetriever()).thenReturn(mock(EventSourceRetriever.class));
3641
}

operator-framework/pom.xml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@
5757
<artifactId>compile-testing</artifactId>
5858
<scope>test</scope>
5959
</dependency>
60-
<dependency>
61-
<groupId>io.fabric8</groupId>
62-
<artifactId>crd-generator-apt</artifactId>
63-
<scope>test</scope>
64-
</dependency>
6560
<!-- This is just here to make some special test using Route, Openshift is actually not used in tests -->
6661
<dependency>
6762
<groupId>io.fabric8</groupId>
@@ -113,7 +108,52 @@
113108
</execution>
114109
</executions>
115110
</plugin>
111+
<plugin>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-surefire-plugin</artifactId>
114+
<configuration>
115+
<reportFormat>plain</reportFormat>
116+
<consoleOutputReporter>
117+
<disable>true</disable>
118+
</consoleOutputReporter>
119+
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
120+
<theme>UNICODE</theme>
121+
</statelessTestsetInfoReporter>
122+
</configuration>
123+
<dependencies>
124+
<dependency>
125+
<groupId>me.fabriciorby</groupId>
126+
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
127+
<version>1.3.0</version>
128+
</dependency>
129+
</dependencies>
130+
</plugin>
116131
</plugins>
117132
</build>
118133

134+
<profiles>
135+
<profile>
136+
<id>apt</id>
137+
<activation>
138+
<activeByDefault>true</activeByDefault>
139+
</activation>
140+
<dependencies>
141+
<dependency>
142+
<groupId>io.fabric8</groupId>
143+
<artifactId>crd-generator-apt</artifactId>
144+
<scope>test</scope>
145+
</dependency>
146+
</dependencies>
147+
</profile>
148+
<profile>
149+
<id>no-apt</id>
150+
<activation>
151+
<property>
152+
<name>no-apt</name>
153+
</property>
154+
</activation>
155+
<dependencies/>
156+
</profile>
157+
</profiles>
158+
119159
</project>

pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@
255255
<groupId>org.apache.maven.plugins</groupId>
256256
<artifactId>maven-compiler-plugin</artifactId>
257257
<version>${maven-compiler-plugin.version}</version>
258+
<configuration>
259+
<compilerArgs>
260+
<arg>-Aio.fabric8.crd.generator.parallel=true</arg>
261+
</compilerArgs>
262+
</configuration>
258263
</plugin>
259264
<plugin>
260265
<groupId>org.apache.maven.plugins</groupId>
@@ -367,7 +372,7 @@
367372
</build>
368373
</profile>
369374
<profile>
370-
<id>no-unit-tests</id>
375+
<id>integration-tests</id>
371376
<build>
372377
<plugins>
373378
<plugin>
@@ -386,6 +391,66 @@
386391
</plugins>
387392
</build>
388393
</profile>
394+
<profile>
395+
<id>integration-tests-baseapi</id>
396+
<build>
397+
<plugins>
398+
<plugin>
399+
<groupId>org.apache.maven.plugins</groupId>
400+
<artifactId>maven-surefire-plugin</artifactId>
401+
<configuration>
402+
<includes>
403+
<include>io/javaoperatorsdk/operator/baseapi/**/*IT.java</include>
404+
</includes>
405+
<excludes>
406+
<exclude>**/*Test.java</exclude>
407+
<exclude>**/*E2E.java</exclude>
408+
</excludes>
409+
</configuration>
410+
</plugin>
411+
</plugins>
412+
</build>
413+
</profile>
414+
<profile>
415+
<id>integration-tests-dependent</id>
416+
<build>
417+
<plugins>
418+
<plugin>
419+
<groupId>org.apache.maven.plugins</groupId>
420+
<artifactId>maven-surefire-plugin</artifactId>
421+
<configuration>
422+
<includes>
423+
<include>io/javaoperatorsdk/operator/dependent/**/*IT.java</include>
424+
</includes>
425+
<excludes>
426+
<exclude>**/*Test.java</exclude>
427+
<exclude>**/*E2E.java</exclude>
428+
</excludes>
429+
</configuration>
430+
</plugin>
431+
</plugins>
432+
</build>
433+
</profile>
434+
<profile>
435+
<id>integration-tests-workflow</id>
436+
<build>
437+
<plugins>
438+
<plugin>
439+
<groupId>org.apache.maven.plugins</groupId>
440+
<artifactId>maven-surefire-plugin</artifactId>
441+
<configuration>
442+
<includes>
443+
<include>io/javaoperatorsdk/operator/workflow/**/*IT.java</include>
444+
</includes>
445+
<excludes>
446+
<exclude>**/*Test.java</exclude>
447+
<exclude>**/*E2E.java</exclude>
448+
</excludes>
449+
</configuration>
450+
</plugin>
451+
</plugins>
452+
</build>
453+
</profile>
389454
<!-- Special category of tests. See usage in source code. -->
390455
<profile>
391456
<id>minimal-watch-timeout-dependent-it</id>

0 commit comments

Comments
 (0)