Skip to content

Commit

Permalink
Prevent
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro authored and fniephaus committed Mar 21, 2024
1 parent 7a7f266 commit 3bef401
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Provider<Task> diff = tasks.register("diff", DefaultTask) { task ->
}

List<String> diffCoordinates = new ArrayList<>()
boolean testAll = false
if (project.hasProperty("baseCommit")) {
String baseCommit = project.findProperty("baseCommit")
String newCommit = Objects.requireNonNullElse(project.findProperty("newCommit"), "HEAD")
Expand All @@ -87,6 +88,8 @@ if (project.hasProperty("baseCommit")) {
dependsOn(taskTaskName)
}
}

testAll = tck.shouldTestAll()
}

def matrixDefault = [
Expand Down Expand Up @@ -136,13 +139,22 @@ Provider<Task> generateMatrixDiffCoordinates = tasks.register("generateMatrixDif
]

matrix.putAll(matrixDefault)

/**
* when we are introducing a new metadata, we should test it against all versions,
* not just the oldest and the newest one (which we are testing by default)
* if we changed some files from tck-build-logic or github workflows, we must run all tests
* to check if we accidentally broke something. In this case, we will have a lots of tests, so we can't
* run them with all possible JDK versions, because we will hit the following error:
* Strategy expansion exceeded 256 results for job 'test-changed-metadata'
*/
matrix.version.add("21")
matrix.version.add("22")
matrix.version.add("dev")
if (!testAll) {
/**
* when we are introducing a new metadata, we should test it against all versions,
* not just the oldest and the newest one (which we are testing by default)
*/
matrix.version.add("21")
matrix.version.add("22")
matrix.version.add("dev")
}
println "::set-output name=matrix::${JsonOutput.toJson(matrix)}"
println "::set-output name=none-found::false"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Path getTestDir(String coordinates) {
throw new RuntimeException("Missing test-directory for coordinates `" + coordinates + "`");
}

private boolean shouldTestAll = false;

public boolean shouldTestAll() {
return shouldTestAll;
}

/**
* Returns a list of coordinates that match changed files between baseCommit and newCommit.
*
Expand Down Expand Up @@ -154,6 +160,7 @@ List<String> diffCoordinates(String baseCommit, String newCommit) {
}));

if (testAll.get()) {
shouldTestAll = true;
// If tck was changed we should retest everything, just to be safe.
return getMatchingCoordinates("");
}
Expand Down

0 comments on commit 3bef401

Please sign in to comment.