Skip to content

Commit

Permalink
Merge pull request #201 from holixon/feature/separate-build-profiles
Browse files Browse the repository at this point in the history
chore: fix the build problems
  • Loading branch information
smcvb authored Nov 25, 2021
2 parents bcc5824 + f63048d commit 82d42c6
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 67 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,27 @@ jobs:
restore-keys: |
${{ runner.os }}-maven
- name: Maven operation with Sonar
if: matrix.sonar-enabled
- name: Regular build
run: |
mvn -B -U -Pcoverage \
clean verify \
sonar:sonar \
./mvnw -B -U clean verify
- name: Sonar analysis
if: matrix.sonar-enabled
run: | # no clean
./mvnw -B sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-kafka \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: | # no clean
./mvnw -B -Pitest
- name: Deploy to Sonatype
if: success()
run: |
./mvnw -B -U deploy -DskipTests=true
run: | # no clean, no tests, no examples
./mvnw -B -U deploy -DskipTests=true -DskipExamples=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_ID }}
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ jobs:
matrix:
include:
- java-version: 8
sonar-enabled: false
- java-version: 11
sonar-enabled: true
fail-fast: false # run both to the end

steps:
- name: Checkout code
Expand All @@ -36,22 +35,10 @@ jobs:
restore-keys: |
${{ runner.os }}-maven
- name: Maven operation with Sonar
if: matrix.sonar-enabled
- name: Run regular build
run: |
mvn -B -U -Pcoverage \
clean verify \
sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-kafka \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
./mvnw -B -U clean verify
- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: | # no clean
./mvnw -B -Pitest
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,25 @@ If you're using IntelliJ IDEA, you can download the code style
definition [here](https://github.com/AxonFramework/AxonFramework/blob/master/axon_code_style.xml). Simply import the XML
file in under "Settings -> Code Style -> Scheme -> Import Scheme". Doing so should make the code style selectable
immediately.

### Project Build

The project is built with Apache Maven, supplied by the Maven Wrapper `mvnw`. For separate aspects of the build Maven
profiles are used.

For a **regular** build, execute from your command line: `./mvnw`. This operation will run the build and execute JUnit tests
of all modules and package the resulting artifacts.

This repository contains an example project.
You can skip its build by adding `-DskipExamples` to your build command.

There are long-running integration tests present (starting Spring Boot Application and/or running Kafka in a TestContainer), which **ARE NOT** executed by default.
A unique `itest` build is needed to run those long-running tests.
If you want to run them, please call `./mvnw -Pitest` from your command line.
When introducing additional integration tests, make sure the class name ends with `IntegrationTest`.

The project uses JaCoCo to measure test coverage of the code and automatically generate coverage reports on regular
and `itest` builds. If you are interested in the overall test coverage, please run `./mvnw -Pcoverage-aggregate`
(without calling `clean`) after you run the **regular** and `itest` builds and check the resulting aggregated report
in `./coverage-report-generator/target/site/jacoco-aggregate/index.html`

69 changes: 69 additions & 0 deletions coverage-report-generator/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2021. Axon Framework
~
~ Licensed 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.
-->

<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.axonframework.extensions.kafka</groupId>
<artifactId>axon-kafka-parent</artifactId>
<version>4.6.0-SNAPSHOT</version>
</parent>

<artifactId>axon-kafka-coverage-report-generator</artifactId>
<version>4.6.0-SNAPSHOT</version>

<name>Axon Framework Kafka Extension - Coverage Report Generator</name>
<description>Coverage Report Generator for the Axon Kafka Extension</description>

<organization>
<name>AxonIQ B.V.</name>
<url>https://axoniq.io</url>
</organization>

<dependencies>
<dependency>
<groupId>org.axonframework.extensions.kafka</groupId>
<artifactId>axon-kafka</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.axonframework.extensions.kafka</groupId>
<artifactId>axon-kafka-spring-boot-autoconfigure</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@EnableAutoConfiguration
@ExtendWith(SpringExtension.class)
@TestPropertySource("classpath:application-map-style.properties")
class KafkaPropertiesTest {
class KafkaPropertiesIntegrationTest {

private static final String PROPERTY_KEY_ONE = "keyOne";
private static final String PROPERTY_VALUE_ONE = "valueOne";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* @author Nakul Mishra
* @author Steven van Beelen
*/
class KafkaAutoConfigurationTest {
class KafkaAutoConfigurationIntegrationTest {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.class));
Expand Down
5 changes: 0 additions & 5 deletions kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@
<version>${jmh-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* @author Steven van Beelen
*/

class AsyncFetcherTest extends KafkaContainerTest {
class AsyncFetcherIntegrationTest extends KafkaContainerTest {

private static final String TEST_TOPIC = "some-topic";
private static final int TEST_PARTITION = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author Nakul Mishra
* @author Steven van Beelen
*/
class DefaultConsumerFactoryTest extends KafkaContainerTest {
class DefaultConsumerFactoryIntegrationTest extends KafkaContainerTest {

private static final String TEST_TOPIC = "testCreatedConsumer_ValidConfig_CanCommunicateToKafka";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @author Lucas Campos
* @author Nakul Mishra
*/
class DefaultProducerFactoryClusteringTest extends KafkaContainerClusterTest {
class DefaultProducerFactoryClusteringIntegrationTest extends KafkaContainerClusterTest {

private static final String TOPIC = "testSendingMessagesUsingMultipleTransactionalProducers";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @author Steven van Beelen
* @author Nakul Mishra
*/
class DefaultProducerFactoryTest extends KafkaContainerTest {
class DefaultProducerFactoryIntegrationTest extends KafkaContainerTest {

private static final String[] TOPICS = {
"testProducerCreation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
* @author Steven van Beelen
* @author Nakul Mishra
*/
class KafkaPublisherTest extends KafkaContainerTest {
class KafkaPublisherIntegrationTest extends KafkaContainerTest {

private static final String[] TOPICS = {
"testPublishMessagesWithAckModeNoUnitOfWorkShouldBePublishedAndReadSuccessfully",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Lucas Campos
*/
@Testcontainers
public class KafkaContainerClusterTest {
public abstract class KafkaContainerClusterTest {

@Container
protected static final KafkaContainerCluster KAFKA_CLUSTER = new KafkaContainerCluster("5.4.3", 3, 1);
Expand Down
Loading

0 comments on commit 82d42c6

Please sign in to comment.