Skip to content

Commit 82d42c6

Browse files
authored
Merge pull request #201 from holixon/feature/separate-build-profiles
chore: fix the build problems
2 parents bcc5824 + f63048d commit 82d42c6

File tree

14 files changed

+249
-67
lines changed

14 files changed

+249
-67
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,27 @@ jobs:
4040
restore-keys: |
4141
${{ runner.os }}-maven
4242
43-
- name: Maven operation with Sonar
44-
if: matrix.sonar-enabled
43+
- name: Regular build
4544
run: |
46-
mvn -B -U -Pcoverage \
47-
clean verify \
48-
sonar:sonar \
45+
./mvnw -B -U clean verify
46+
47+
- name: Sonar analysis
48+
if: matrix.sonar-enabled
49+
run: | # no clean
50+
./mvnw -B sonar:sonar \
4951
-Dsonar.projectKey=AxonFramework_extension-kafka \
5052
-Dsonar.organization=axonframework \
5153
-Dsonar.host.url=https://sonarcloud.io \
5254
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555
56-
- name: Maven operation without Sonar
57-
if: matrix.sonar-enabled != true
58-
run: |
59-
mvn -B -U clean verify
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Run integration tests
57+
run: | # no clean
58+
./mvnw -B -Pitest
6259
6360
- name: Deploy to Sonatype
6461
if: success()
65-
run: |
66-
./mvnw -B -U deploy -DskipTests=true
62+
run: | # no clean, no tests, no examples
63+
./mvnw -B -U deploy -DskipTests=true -DskipExamples=true
6764
env:
6865
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6966
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_ID }}

.github/workflows/pullrequest.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ jobs:
1111
matrix:
1212
include:
1313
- java-version: 8
14-
sonar-enabled: false
1514
- java-version: 11
16-
sonar-enabled: true
15+
fail-fast: false # run both to the end
1716

1817
steps:
1918
- name: Checkout code
@@ -36,22 +35,10 @@ jobs:
3635
restore-keys: |
3736
${{ runner.os }}-maven
3837
39-
- name: Maven operation with Sonar
40-
if: matrix.sonar-enabled
38+
- name: Run regular build
4139
run: |
42-
mvn -B -U -Pcoverage \
43-
clean verify \
44-
sonar:sonar \
45-
-Dsonar.projectKey=AxonFramework_extension-kafka \
46-
-Dsonar.organization=axonframework \
47-
-Dsonar.host.url=https://sonarcloud.io \
48-
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
./mvnw -B -U clean verify
5141
52-
- name: Maven operation without Sonar
53-
if: matrix.sonar-enabled != true
54-
run: |
55-
mvn -B -U clean verify
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Run integration tests
43+
run: | # no clean
44+
./mvnw -B -Pitest

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,25 @@ If you're using IntelliJ IDEA, you can download the code style
3636
definition [here](https://github.com/AxonFramework/AxonFramework/blob/master/axon_code_style.xml). Simply import the XML
3737
file in under "Settings -> Code Style -> Scheme -> Import Scheme". Doing so should make the code style selectable
3838
immediately.
39+
40+
### Project Build
41+
42+
The project is built with Apache Maven, supplied by the Maven Wrapper `mvnw`. For separate aspects of the build Maven
43+
profiles are used.
44+
45+
For a **regular** build, execute from your command line: `./mvnw`. This operation will run the build and execute JUnit tests
46+
of all modules and package the resulting artifacts.
47+
48+
This repository contains an example project.
49+
You can skip its build by adding `-DskipExamples` to your build command.
50+
51+
There are long-running integration tests present (starting Spring Boot Application and/or running Kafka in a TestContainer), which **ARE NOT** executed by default.
52+
A unique `itest` build is needed to run those long-running tests.
53+
If you want to run them, please call `./mvnw -Pitest` from your command line.
54+
When introducing additional integration tests, make sure the class name ends with `IntegrationTest`.
55+
56+
The project uses JaCoCo to measure test coverage of the code and automatically generate coverage reports on regular
57+
and `itest` builds. If you are interested in the overall test coverage, please run `./mvnw -Pcoverage-aggregate`
58+
(without calling `clean`) after you run the **regular** and `itest` builds and check the resulting aggregated report
59+
in `./coverage-report-generator/target/site/jacoco-aggregate/index.html`
60+

coverage-report-generator/pom.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2010-2021. Axon Framework
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
21+
<parent>
22+
<groupId>org.axonframework.extensions.kafka</groupId>
23+
<artifactId>axon-kafka-parent</artifactId>
24+
<version>4.6.0-SNAPSHOT</version>
25+
</parent>
26+
27+
<artifactId>axon-kafka-coverage-report-generator</artifactId>
28+
<version>4.6.0-SNAPSHOT</version>
29+
30+
<name>Axon Framework Kafka Extension - Coverage Report Generator</name>
31+
<description>Coverage Report Generator for the Axon Kafka Extension</description>
32+
33+
<organization>
34+
<name>AxonIQ B.V.</name>
35+
<url>https://axoniq.io</url>
36+
</organization>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.axonframework.extensions.kafka</groupId>
41+
<artifactId>axon-kafka</artifactId>
42+
<version>${project.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.axonframework.extensions.kafka</groupId>
46+
<artifactId>axon-kafka-spring-boot-autoconfigure</artifactId>
47+
<version>${project.version}</version>
48+
</dependency>
49+
</dependencies>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.jacoco</groupId>
55+
<artifactId>jacoco-maven-plugin</artifactId>
56+
<executions>
57+
<execution>
58+
<id>report-aggregate</id>
59+
<phase>verify</phase>
60+
<goals>
61+
<goal>report-aggregate</goal>
62+
</goals>
63+
</execution>
64+
</executions>
65+
</plugin>
66+
</plugins>
67+
</build>
68+
69+
</project>

kafka-spring-boot-autoconfigure/src/test/java/org/axonframework/extensions/kafka/KafkaPropertiesTest.java renamed to kafka-spring-boot-autoconfigure/src/test/java/org/axonframework/extensions/kafka/KafkaPropertiesIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
@EnableAutoConfiguration
3636
@ExtendWith(SpringExtension.class)
3737
@TestPropertySource("classpath:application-map-style.properties")
38-
class KafkaPropertiesTest {
38+
class KafkaPropertiesIntegrationTest {
3939

4040
private static final String PROPERTY_KEY_ONE = "keyOne";
4141
private static final String PROPERTY_VALUE_ONE = "valueOne";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
* @author Nakul Mishra
7070
* @author Steven van Beelen
7171
*/
72-
class KafkaAutoConfigurationTest {
72+
class KafkaAutoConfigurationIntegrationTest {
7373

7474
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
7575
.withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.class));

kafka/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@
6868
<version>${jmh-core.version}</version>
6969
<scope>test</scope>
7070
</dependency>
71-
<dependency>
72-
<groupId>org.junit.jupiter</groupId>
73-
<artifactId>junit-jupiter</artifactId>
74-
<scope>test</scope>
75-
</dependency>
7671
<dependency>
7772
<groupId>org.testcontainers</groupId>
7873
<artifactId>junit-jupiter</artifactId>

kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/consumer/AsyncFetcherTest.java renamed to kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/consumer/AsyncFetcherIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
* @author Steven van Beelen
6060
*/
6161

62-
class AsyncFetcherTest extends KafkaContainerTest {
62+
class AsyncFetcherIntegrationTest extends KafkaContainerTest {
6363

6464
private static final String TEST_TOPIC = "some-topic";
6565
private static final int TEST_PARTITION = 0;

kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/consumer/DefaultConsumerFactoryTest.java renamed to kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/consumer/DefaultConsumerFactoryIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* @author Nakul Mishra
4141
* @author Steven van Beelen
4242
*/
43-
class DefaultConsumerFactoryTest extends KafkaContainerTest {
43+
class DefaultConsumerFactoryIntegrationTest extends KafkaContainerTest {
4444

4545
private static final String TEST_TOPIC = "testCreatedConsumer_ValidConfig_CanCommunicateToKafka";
4646

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* @author Lucas Campos
4242
* @author Nakul Mishra
4343
*/
44-
class DefaultProducerFactoryClusteringTest extends KafkaContainerClusterTest {
44+
class DefaultProducerFactoryClusteringIntegrationTest extends KafkaContainerClusterTest {
4545

4646
private static final String TOPIC = "testSendingMessagesUsingMultipleTransactionalProducers";
4747

kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/producer/DefaultProducerFactoryTest.java renamed to kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/producer/DefaultProducerFactoryIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* @author Steven van Beelen
5050
* @author Nakul Mishra
5151
*/
52-
class DefaultProducerFactoryTest extends KafkaContainerTest {
52+
class DefaultProducerFactoryIntegrationTest extends KafkaContainerTest {
5353

5454
private static final String[] TOPICS = {
5555
"testProducerCreation",

kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/producer/KafkaPublisherTest.java renamed to kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/producer/KafkaPublisherIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
* @author Steven van Beelen
7171
* @author Nakul Mishra
7272
*/
73-
class KafkaPublisherTest extends KafkaContainerTest {
73+
class KafkaPublisherIntegrationTest extends KafkaContainerTest {
7474

7575
private static final String[] TOPICS = {
7676
"testPublishMessagesWithAckModeNoUnitOfWorkShouldBePublishedAndReadSuccessfully",

kafka/src/test/java/org/axonframework/extensions/kafka/eventhandling/util/KafkaContainerClusterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Lucas Campos
1010
*/
1111
@Testcontainers
12-
public class KafkaContainerClusterTest {
12+
public abstract class KafkaContainerClusterTest {
1313

1414
@Container
1515
protected static final KafkaContainerCluster KAFKA_CLUSTER = new KafkaContainerCluster("5.4.3", 3, 1);

0 commit comments

Comments
 (0)