-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DROOLS-6495] Implement backward compatibility test for compiled kjar
- WIP
- Loading branch information
Showing
14 changed files
with
485 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Drools Backward Compatibility | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'LICENSE' | ||
- '**/.gitignore' | ||
- '**.md' | ||
- '**.adoc' | ||
- '*.txt' | ||
- 'docsimg/**' | ||
- '.ci/jenkins/**' | ||
|
||
jobs: | ||
drools-build: | ||
concurrency: | ||
group: pr-drools-backward-compatibility_${{ matrix.os }}_${{ matrix.java-version }}_${{ matrix.maven-version }}_${{ github.head_ref }} | ||
cancel-in-progress: true | ||
timeout-minutes: 120 | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
java-version: [11] | ||
maven-version: ['3.8.7'] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os }} / Java-${{ matrix.java-version }} / Maven-${{ matrix.maven-version }} | ||
steps: | ||
- name: Clean Disk Space | ||
uses: kiegroup/kie-ci/.ci/actions/ubuntu-disk-space@main | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
- name: Support long paths | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
uses: kiegroup/kie-ci/.ci/actions/long-paths@main | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Java and Maven Setup | ||
uses: kiegroup/kie-ci/.ci/actions/maven@main | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
maven-version: ${{ matrix.maven-version }} | ||
cache-key-prefix: ${{ runner.os }}-${{ matrix.java-version }}-maven${{ matrix.maven-version }} | ||
- name: Build Drools | ||
run: mvn -B clean install -DskipTests | ||
- name: Backward Compatibility Test with previous minor version | ||
run: | | ||
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
PREVIOUS_VERSION=$(script/utils/get_previous_version.sh $CURRENT_VERSION) | ||
mvn -B clean install --file drools-reference-examples/pom.xml -Preference -Dreference.kjar.drools.version=$PREVIOUS_VERSION | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
`drools-reference-examples` contains internal reference examples which can be used for smoke tests, backward compatibility tests, etc. | ||
|
||
To run the project, enable the `reference` profile: | ||
|
||
cd drools-reference-examples | ||
mvn clean install -Preference | ||
|
||
By default, kjar projects are built with the current project version of `kie-maven-plugin`. To build with a specific version of `kie-maven-plugin`, use `reference.kjar.drools.version` property: | ||
|
||
mvn clean install -Preference -Dreference.kjar.drools.version=8.39.0.Final | ||
|
20 changes: 20 additions & 0 deletions
20
drools-reference-examples/drools-reference-examples-common/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples</artifactId> | ||
<version>8.44.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>drools-reference-examples-common</artifactId> | ||
|
||
<name>Drools reference examples :: Common</name> | ||
<description>Pojo classes for kjar and tests</description> | ||
|
||
<properties> | ||
<java.module.name>org.drools.reference.examples.common</java.module.name> | ||
</properties> | ||
|
||
</project> |
47 changes: 47 additions & 0 deletions
47
...rence-examples-common/src/main/java/org/drools/reference/examples/helloworld/Message.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2023 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package org.drools.reference.examples.helloworld; | ||
|
||
public class Message { | ||
|
||
public static final int HELLO = 0; | ||
public static final int GOODBYE = 1; | ||
|
||
private String message; | ||
|
||
private int status; | ||
|
||
public Message() { | ||
|
||
} | ||
|
||
public String getMessage() { | ||
return this.message; | ||
} | ||
|
||
public void setMessage(final String message) { | ||
this.message = message; | ||
} | ||
|
||
public int getStatus() { | ||
return this.status; | ||
} | ||
|
||
public void setStatus(final int status) { | ||
this.status = status; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
drools-reference-examples/drools-reference-examples-kjar/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples</artifactId> | ||
<version>8.44.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>drools-reference-examples-kjar</artifactId> | ||
<packaging>kjar</packaging> | ||
|
||
<name>Drools reference examples :: kjar</name> | ||
<description>Reference example kjar</description> | ||
|
||
<properties> | ||
<java.module.name>org.drools.reference.examples.kjar</java.module.name> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples-common</artifactId> | ||
</dependency> | ||
|
||
<!-- use specified drools version to build a kjar --> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-engine</artifactId> | ||
<version>${reference.kjar.drools.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-model-compiler</artifactId> | ||
<version>${reference.kjar.drools.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-enforcer-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<!-- suppress enforcer no-managed-deps --> | ||
<id>no-managed-deps</id> | ||
<phase>none</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-maven-plugin</artifactId> | ||
<version>${reference.kjar.drools.version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
7 changes: 7 additions & 0 deletions
7
...reference-examples/drools-reference-examples-kjar/src/main/resources/META-INF/kmodule.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://www.drools.org/xsd/kmodule"> | ||
<kbase name="HelloWorldKB" packages="org.drools.reference.examples.helloworld"> | ||
<ksession name="HelloWorldKS"/> | ||
</kbase> | ||
</kmodule> |
41 changes: 41 additions & 0 deletions
41
...-examples-kjar/src/main/resources/org/drools/reference/examples/helloworld/HelloWorld.drl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2023 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package org.drools.reference.examples.helloworld | ||
|
||
import org.drools.reference.examples.helloworld.Message; | ||
|
||
global java.util.List list | ||
|
||
rule "Hello World" | ||
dialect "mvel" | ||
when | ||
m : Message( status == Message.HELLO, message : message ) | ||
then | ||
System.out.println( message ); | ||
list.add( message ); | ||
modify ( m ) { message = "Goodbye cruel world", | ||
status = Message.GOODBYE }; | ||
end | ||
|
||
rule "Good Bye" | ||
dialect "java" | ||
when | ||
Message( status == Message.GOODBYE, message : message ) | ||
then | ||
System.out.println( message ); | ||
list.add( message ); | ||
end |
67 changes: 67 additions & 0 deletions
67
drools-reference-examples/drools-reference-examples-tests/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples</artifactId> | ||
<version>8.44.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>drools-reference-examples-tests</artifactId> | ||
|
||
<name>Drools reference examples :: tests</name> | ||
<description>Reference example tests</description> | ||
|
||
<properties> | ||
<java.module.name>org.drools.reference.examples.tests</java.module.name> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-reference-examples-kjar</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-xml-support</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-ci</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.