Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions .github/scripts/junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@
SKIPPED = "SKIPPED 🙈"


def get_env(key: str) -> str:
def get_env(key: str, fn = str) -> Optional:
value = os.getenv(key)
logger.debug(f"Read env {key}: {value}")
return value
if value is None:
logger.debug(f"Could not find env {key}")
return None
else:
logger.debug(f"Read env {key}: {value}")
return fn(value)


@dataclasses.dataclass
Expand Down Expand Up @@ -248,12 +252,23 @@ def pretty_time_duration(seconds: float) -> str:
print(f"| {row_joined} |")
print("\n</details>")

logger.debug(summary)
if total_failures > 0:
logger.debug(f"Failing this step due to {total_failures} test failures")
exit(1)
elif total_errors > 0:
logger.debug(f"Failing this step due to {total_errors} test errors")
# Print special message if there was a timeout
exit_code = get_env("GRADLE_EXIT_CODE", int)
if exit_code == 124:
logger.debug(f"Gradle command timed out. These are partial results!")
logger.debug(summary)
logger.debug("Failing this step because the tests timed out.")
exit(1)
elif exit_code in (0, 1):
logger.debug(summary)
if total_failures > 0:
logger.debug(f"Failing this step due to {total_failures} test failures")
exit(1)
elif total_errors > 0:
logger.debug(f"Failing this step due to {total_errors} test errors")
exit(1)
else:
exit(0)
else:
exit(0)
logger.debug(f"Gradle had unexpected exit code {exit_code}. Failing this step")
exit(1)
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ jobs:
# --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks.
# --continue: Keep running even if a test fails
# -PcommitId Prevent the Git SHA being written into the jar files (which breaks caching)
timeout-minutes: 180 # 3 hours
continue-on-error: true
id: junit-test
run: |
./gradlew --build-cache --scan --continue \
set +e
timeout 180m ./gradlew --build-cache --scan --continue \
-PtestLoggingEvents=started,passed,skipped,failed \
-PmaxParallelForks=2 \
-PmaxTestRetries=1 -PmaxTestRetryFailures=10 \
-PcommitId=xxxxxxxxxxxxxxxx \
test
exitcode="$?"
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
- name: Archive JUnit reports
if: always()
uses: actions/upload-artifact@v4
id: junit-upload-artifact
with:
Expand All @@ -126,8 +127,8 @@ jobs:
**/build/reports/tests/test/*
if-no-files-found: ignore
- name: Parse JUnit tests
if: always()
run: python .github/scripts/junit.py >> $GITHUB_STEP_SUMMARY
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
REPORT_URL: ${{ steps.junit-upload-artifact.outputs.artifact-url }}
GRADLE_EXIT_CODE: ${{ steps.junit-test.outputs.exitcode }}