Skip to content

Commit

Permalink
Implement basic Flaky Run Reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed Feb 15, 2024
1 parent fb1de05 commit 04f404a
Show file tree
Hide file tree
Showing 13 changed files with 357 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
41 changes: 41 additions & 0 deletions .github/mvn-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers/>
<profiles>
<profile>
<id>google-mirror-jboss-proxy</id>
<repositories>
<repository>
<id>google-maven-central</id>
<name>GCS Maven Central mirror EU</name>
<url>https://maven-central-eu.storage-download.googleapis.com/repos/central/data/</url>
</repository>
<repository>
<id>jboss-maven-central-proxy</id>
<name>JBoss Maven Central proxy</name>
<url>https://repository.jboss.org/nexus/content/repositories/central/</url>
</repository>
<repository>
<id>gradle-official-repository</id>
<name>Gradle Official Repository</name>
<url>https://repo.gradle.org/gradle/libs-releases-local/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>google-maven-central</id>
<name>GCS Maven Central mirror EU</name>
<url>https://maven-central-eu.storage-download.googleapis.com/repos/central/data/</url>
</pluginRepository>
<pluginRepository>
<id>jboss-maven-central-proxy</id>
<name>JBoss Maven Central proxy</name>
<url>https://repository.jboss.org/nexus/content/repositories/central/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>google-mirror-jboss-proxy</activeProfile>
</activeProfiles>
</settings>
4 changes: 4 additions & 0 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: Quarkus QE Test Framework
release:
current-version: 0.1.0.Beta1
next-version: 0.1.1.Beta1
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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/)
27 changes: 27 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file added .github/release/maven-settings.xml.gpg
Binary file not shown.
27 changes: 27 additions & 0 deletions .github/upstream-release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name-template: '1.1.x 🌈'
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.1.x Changes
$CHANGES
All contributors: $CONTRIBUTORS
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build

on:
push:
branches:
- "main"
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'README*'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'README*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17

- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m")"
shell: bash
- name: Cache Maven Repository
id: cache-maven
uses: actions/cache@v2
with:
path: ~/.m2/repository
# refresh cache every month to avoid unlimited growth
key: maven-repo-${{ steps.get-date.outputs.date }}

- name: Build with Maven
run: mvn -B formatter:validate verify --file pom.xml

- name: Delete Artifacts From Cache
shell: bash
run: rm -rf ~/.m2/repository/io/quarkus/bot/
17 changes: 17 additions & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release notes
on:
workflow_dispatch:
milestone:
types: [closed]
push:
branches:
- main
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: upstream-release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
pull_request:
types: [closed]
paths:
- '.github/project.yml'

jobs:
release:
runs-on: ubuntu-latest
name: release
if: ${{github.event.pull_request.merged == true}}

steps:
- uses: radcortez/project-metadata-action@master
name: Retrieve project metadata
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- uses: actions/checkout@v4

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Install JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
check-latest: true

- name: Configure Git author
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Maven release ${{steps.metadata.outputs.current-version}}
run: |
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.GPG_PASSPHRASE}}" --output maven-settings.xml .github/release/maven-settings.xml.gpg
git checkout -b release
mvn -B release:prepare -Prelease,framework,extensions,examples -DautoVersionSubmodules -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -s maven-settings.xml
git checkout ${{github.base_ref}}
git rebase release
mvn -B release:perform -DskipITs -Prelease,framework -s maven-settings.xml
- name: Push changes to ${{github.base_ref}}
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{github.base_ref}}

- name: Push tags
uses: ad-m/[email protected]
with:
branch: ${{github.base_ref}}
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
83 changes: 82 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>io.quarkus.qe</groupId>
<artifactId>flaky-run-reporter</artifactId>
<name>Flaky Run Reporter - Maven Extension</name>
<version>1.0-SNAPSHOT</version>
<version>0.1.1.Beta1-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down Expand Up @@ -63,4 +63,85 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{project.version}</tagNameFormat>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
<remoteTagging>false</remoteTagging>
<arguments>-DskipTests=true</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<developers>
<developer>
<id>quarkus-qe</id>
<name>Quarkus QE</name>
<organization>Quarkus QE</organization>
<url>https://github.com/quarkus-qe</url>
</developer>
</developers>

<scm>
<connection>scm:git:[email protected]:quarkus-qe/flaky-run-reporter.git</connection>
<developerConnection>scm:git:[email protected]:quarkus-qe/flaky-run-reporter.git</developerConnection>
<url>https://github.com/quarkus-qe/flaky-run-reporter</url>
<tag>HEAD</tag>
</scm>
<url>https://github.com/quarkus-qe/flaky-run-reporter/</url>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/quarkus-qe/flaky-run-reporter/issues</url>
</issueManagement>
</project>
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -32,7 +33,19 @@ public class FlakyRunReporter {
this.logger = logger;
}

void createFlakyRunReport() {
public static List<FlakyTest> 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()));
}

Expand Down
Loading

0 comments on commit 04f404a

Please sign in to comment.