From 04f404af65053fd946cb72b5eca2c9780d06696d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Thu, 15 Feb 2024 21:54:07 +0100 Subject: [PATCH] Implement basic Flaky Run Reporter --- .github/dependabot.yml | 11 +++ .github/mvn-settings.xml | 41 +++++++++ .github/project.yml | 4 + .github/pull_request_template.md | 18 ++++ .github/release-drafter.yml | 27 ++++++ .github/release/maven-settings.xml.gpg | Bin 0 -> 336 bytes .github/upstream-release-drafter.yml | 27 ++++++ .github/workflows/build.yml | 51 +++++++++++ .github/workflows/release-notes.yml | 17 ++++ .github/workflows/release.yml | 62 +++++++++++++ pom.xml | 83 +++++++++++++++++- .../reporter/flakyrun/FlakyRunReporter.java | 15 +++- .../qe/reporter/flakyrun/FlakyTest.java | 6 +- 13 files changed, 357 insertions(+), 5 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/mvn-settings.xml create mode 100644 .github/project.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/release-drafter.yml create mode 100644 .github/release/maven-settings.xml.gpg create mode 100644 .github/upstream-release-drafter.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release-notes.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ce22d85 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/mvn-settings.xml b/.github/mvn-settings.xml new file mode 100644 index 0000000..3266834 --- /dev/null +++ b/.github/mvn-settings.xml @@ -0,0 +1,41 @@ + + + + + + google-mirror-jboss-proxy + + + google-maven-central + GCS Maven Central mirror EU + https://maven-central-eu.storage-download.googleapis.com/repos/central/data/ + + + jboss-maven-central-proxy + JBoss Maven Central proxy + https://repository.jboss.org/nexus/content/repositories/central/ + + + gradle-official-repository + Gradle Official Repository + https://repo.gradle.org/gradle/libs-releases-local/ + + + + + google-maven-central + GCS Maven Central mirror EU + https://maven-central-eu.storage-download.googleapis.com/repos/central/data/ + + + jboss-maven-central-proxy + JBoss Maven Central proxy + https://repository.jboss.org/nexus/content/repositories/central/ + + + + + + google-mirror-jboss-proxy + + diff --git a/.github/project.yml b/.github/project.yml new file mode 100644 index 0000000..220d8d4 --- /dev/null +++ b/.github/project.yml @@ -0,0 +1,4 @@ +name: Quarkus QE Test Framework +release: + current-version: 0.1.0.Beta1 + next-version: 0.1.1.Beta1 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..cd58b8c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ +### Summary + +(Summarize the problem solved by this PR, and how to verify it manually) + +Please check the relevant options + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Dependency update +- [ ] Refactoring +- [ ] Breaking change (fix or feature that would cause existing functionality to change) +- [ ] This change requires a documentation update +- [ ] This change requires execution against OCP (use `run tests` phrase in comment) + +### Checklist: +- [ ] Example scenarios has been updated / added +- [ ] Methods and classes used in PR scenarios are meaningful +- [ ] Commits are well encapsulated and follow [the best practices](https://cbea.ms/git-commit/) \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..f4af13f --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,27 @@ +name-template: '1.0.z 🌈' +tag-template: 'v$NEXT_PATCH_VERSION' +exclude-labels: + - 'skip-changelog' + - 'release' +categories: + - title: '🚀 New features and improvements' + labels: + - 'new' + - 'feature' + - 'enhancement' + - title: '🐛 Bug fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '📖 Documentation' + labels: + - 'docs' + - 'documentation' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- #$NUMBER: $TITLE (@$AUTHOR)' +template: | + ## 1.0.z Changes + $CHANGES + All contributors: $CONTRIBUTORS \ No newline at end of file diff --git a/.github/release/maven-settings.xml.gpg b/.github/release/maven-settings.xml.gpg new file mode 100644 index 0000000000000000000000000000000000000000..a31b12c47c15a6fd596c0b90657c3a40e9fc8c4a GIT binary patch literal 336 zcmV-W0k8gy4Fm@R0woR5X_a_D`}@+segU`6Y1)11qLr}q2ieUm^1ztUTJf$$7ZrIE zs;Kb)CY6yj$;ivW-!KRE)=RG^C(TFi|AjMy4K`e(c>Di4SzQ|Og#hy(j%N6YNt?kV z;fsC(EKsva1~oJ>e_bAiC}~AV6hHulkoT6^z76aQSJv}0zHTLo9ePfWs5ZUEyv*e?7-uZ>?%?VAmHtRq0RoDdB^e1=zk9O9}f+;m-xJgCB8W5 z0Ik{v0SlP?MYGEC&#ahoS5(V&+n6JEnyv-gio.quarkus.qe flaky-run-reporter Flaky Run Reporter - Maven Extension - 1.0-SNAPSHOT + 0.1.1.Beta1-SNAPSHOT 17 @@ -63,4 +63,85 @@ + + + + release + + + + org.apache.maven.plugins + maven-release-plugin + + true + @{project.version} + false + true + false + -DskipTests=true + + + + org.apache.maven.plugins + maven-gpg-plugin + + + --pinentry-mode + loopback + + + + + sign-artifacts + verify + + sign + + + + + + maven-javadoc-plugin + + + package + + jar + + + + + + + + + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + quarkus-qe + Quarkus QE + Quarkus QE + https://github.com/quarkus-qe + + + + + scm:git:git@github.com:quarkus-qe/flaky-run-reporter.git + scm:git:git@github.com:quarkus-qe/flaky-run-reporter.git + https://github.com/quarkus-qe/flaky-run-reporter + HEAD + + https://github.com/quarkus-qe/flaky-run-reporter/ + + + GitHub + https://github.com/quarkus-qe/flaky-run-reporter/issues + diff --git a/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyRunReporter.java b/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyRunReporter.java index b4e4956..38da836 100644 --- a/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyRunReporter.java +++ b/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyRunReporter.java @@ -1,5 +1,6 @@ package io.quarkus.qe.reporter.flakyrun; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import io.quarkus.bot.build.reporting.model.BuildReport; @@ -32,7 +33,19 @@ public class FlakyRunReporter { this.logger = logger; } - void createFlakyRunReport() { + public static List parseFlakyTestsReport(String reportPathStr) { + Path reportPath = Path.of(reportPathStr); + if (!Files.exists(reportPath)) { + return List.of(); + } + try { + return OBJECT_MAPPER.readValue(reportPath.toFile(), new TypeReference<>() {}); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void createFlakyRunReport() { createFlakyRunReport(buildReportToFlakyTests(getBuildReporter())); } diff --git a/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyTest.java b/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyTest.java index b7372d0..ca7f9c9 100644 --- a/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyTest.java +++ b/src/main/java/io/quarkus/qe/reporter/flakyrun/FlakyTest.java @@ -10,19 +10,19 @@ public record FlakyTest(String projectName, String projectBaseDir, String fullTe String failureType, String failureStackTrace, String dateTime) { static Stream newInstances(ReportTestCase reportTestCase, ProjectReport projectReport) { + final String now = ZonedDateTime.now().toString(); Stream result = Stream.empty(); - ZonedDateTime now = ZonedDateTime.now(); if (!reportTestCase.getFlakyFailures().isEmpty()) { result = reportTestCase.getFlakyFailures() .stream() .map(s -> new FlakyTest(projectReport.getName(), projectReport.getBasedir(), - reportTestCase.getFullName(), s.getMessage(), s.getType(), s.getStackTrace(), now.toString())); + reportTestCase.getFullName(), s.getMessage(), s.getType(), s.getStackTrace(), now)); } if (!reportTestCase.getFlakyErrors().isEmpty()) { result = Stream.concat(result, reportTestCase.getFlakyErrors() .stream() .map(s -> new FlakyTest(projectReport.getName(), projectReport.getBasedir(), - reportTestCase.getFullName(), s.getMessage(), s.getType(), s.getStackTrace(), now.toString()))); + reportTestCase.getFullName(), s.getMessage(), s.getType(), s.getStackTrace(), now))); } return result; }