Add junit tag configuration
- Using include/exclude tags was missing so adding those into buildSrc. - Polish it tests workflows - Relates #1143
This commit is contained in:
2
.github/workflows/mongodb.yml
vendored
2
.github/workflows/mongodb.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: gradle
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=mongodb -PstatemachineTestResults=true
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=mongodb
|
||||
- name: Tar Build Logs
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
|
||||
2
.github/workflows/redis.yml
vendored
2
.github/workflows/redis.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: gradle
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=redis -PstatemachineTestResults=true
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=redis
|
||||
- name: Tar Build Logs
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
|
||||
2
.github/workflows/smoke.yml
vendored
2
.github/workflows/smoke.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: gradle
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=smoke -PstatemachineTestResults=true
|
||||
run: ./gradlew clean build -PstatemachineIncludeTags=smoke
|
||||
- name: Tar Build Logs
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
|
||||
@@ -39,6 +39,8 @@ import org.gradle.external.javadoc.CoreJavadocOptions;
|
||||
class JavaConventions {
|
||||
|
||||
private static final String SOURCE_AND_TARGET_COMPATIBILITY = "17";
|
||||
private static final String INCLUDE_TAGS = "statemachineIncludeTags";
|
||||
private static final String EXCLUDE_TAGS = "statemachineExcludeTags";
|
||||
|
||||
void apply(Project project) {
|
||||
project.getPlugins().withType(JavaBasePlugin.class, java -> {
|
||||
@@ -84,7 +86,31 @@ class JavaConventions {
|
||||
|
||||
private void configureTestConventions(Project project) {
|
||||
project.getTasks().withType(Test.class, test -> {
|
||||
test.useJUnitPlatform();
|
||||
boolean hasIncludeTags = project.hasProperty(INCLUDE_TAGS);
|
||||
boolean hasExcludeTags = project.hasProperty(EXCLUDE_TAGS);
|
||||
test.useJUnitPlatform(options -> {
|
||||
if (!hasIncludeTags && !hasExcludeTags) {
|
||||
options.excludeTags("smoke");
|
||||
}
|
||||
else {
|
||||
if (hasIncludeTags) {
|
||||
Object includeTagsProperty = project.property(INCLUDE_TAGS);
|
||||
if (includeTagsProperty instanceof String p) {
|
||||
if (p.length() > 0) {
|
||||
options.includeTags(p.split(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasExcludeTags) {
|
||||
Object excludeTagsProperty = project.property(EXCLUDE_TAGS);
|
||||
if (excludeTagsProperty instanceof String p) {
|
||||
if (p.length() > 0) {
|
||||
options.excludeTags(p.split(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user