Skip to content

Commit 6b805f3

Browse files
committed
Stop build from failing when task is expected to fail
1 parent 76630ee commit 6b805f3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gradle/plugins/lifecycle-smoke-test-ci-plugin/src/main/java/org/springframework/lifecycle/gradle/GenerateGitHubActionsWorkflows.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ private void writeJob(PrintWriter writer, SmokeTest smokeTest, String taskName)
104104
writer.println(" checkout_ref: " + getGitBranch().get());
105105
writer.println(" project: " + smokeTest.group() + ":" + smokeTest.name());
106106
writer.println(" task: " + taskName);
107+
if (smokeTest.expectedToFail().contains(taskName)) {
108+
writer.println(" expected_to_fail: true");
109+
}
107110
}
108111

109112
private String jobId(String smokeTestName, String taskName) {

gradle/plugins/lifecycle-smoke-test-ci-plugin/src/main/java/org/springframework/lifecycle/gradle/SmokeTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.Serializable;
2020
import java.util.Properties;
21+
import java.util.Set;
2122

2223
/**
2324
* A smoke test.
@@ -28,13 +29,15 @@
2829
* @param path path of the smoke test project
2930
* @param tests whether the smoke test contains any unit tests
3031
* @param appTests whether the smoke test contains any app tests
32+
* @param expectedToFail names of tasks that are expected to fail
3133
*/
3234
public record SmokeTest(String name, String group, String path, boolean tests,
33-
boolean appTests) implements Serializable {
35+
boolean appTests, Set<String> expectedToFail) implements Serializable {
3436

3537
SmokeTest(Properties properties) {
3638
this(properties.getProperty("name"), properties.getProperty("group"), properties.getProperty("path"),
37-
Boolean.valueOf(properties.getProperty("tests")), Boolean.valueOf(properties.getProperty("appTests")));
39+
Boolean.valueOf(properties.getProperty("tests")), Boolean.valueOf(properties.getProperty("appTests")),
40+
Set.of(properties.getProperty("expectedToFail").split(",")));
3841
}
3942

4043
}

0 commit comments

Comments
 (0)