ci: Add server failed tests as PR comment (#30888)
And, don't show duplicates. Not sure why we're seeing duplicates though.
This commit is contained in:
parent
1afd321e13
commit
dbe138778a
11
.github/workflows/server-build.yml
vendored
11
.github/workflows/server-build.yml
vendored
|
|
@ -183,11 +183,16 @@ jobs:
|
|||
args+=("-DtestResultFile=$PWD/failed-server-tests.txt")
|
||||
if ! mvn test "${args[@]}"; then
|
||||
if [[ -s failed-server-tests.txt ]]; then
|
||||
{
|
||||
echo "## Failed tests"
|
||||
content="$(
|
||||
echo "## Failed server tests"
|
||||
echo
|
||||
sed 's/^/- /' 'failed-server-tests.txt'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
)"
|
||||
echo "$content" >> "$GITHUB_STEP_SUMMARY"
|
||||
# Add a comment to the PR with the list of failed tests.
|
||||
curl --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
|
||||
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import org.junit.jupiter.api.extension.TestWatcher;
|
|||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* The TestWatcher interface is used to react to the execution of tests.
|
||||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
*/
|
||||
public class TestResultLoggerExtension implements TestWatcher, AfterAllCallback {
|
||||
|
||||
private final List<String> failedTests = new ArrayList<>();
|
||||
private final Collection<String> failedTests = new TreeSet<>();
|
||||
|
||||
/**
|
||||
* This method is called after all the tests are run. It writes the failed tests to a file.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user