Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix the build problems #201

Merged
merged 4 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,33 @@ 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 \
mvn -B -U clean verify
lfgcampos marked this conversation as resolved.
Show resolved Hide resolved
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
lfgcampos marked this conversation as resolved.
Show resolved Hide resolved

- name: Sonar analysis
if: matrix.sonar-enabled
run: | # no clean
mvn -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
- name: Run integration tests
run: | # no clean
mvn -B -Pitest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- 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
zambrovski marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.sonar-enabled
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 }}

- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
- name: Run regular build
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run integration tests
run: | # no clean
mvn -B -Pitest
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,24 @@ 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 will run the build and execute JUnit tests
of all modules and package the resulting artifacts.

There is an example project supplied, and you can skip its build by passing `-DskipExamples` to your build command.

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

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

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">
zambrovski marked this conversation as resolved.
Show resolved Hide resolved
<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