Skip to content

Commit 66ee788

Browse files
authored
Add unit test report generator (#7411)
Currently not called by any gradle plugins or workflows. Generates a root level file called `test-report.md` with info for a configurable number of commits using the GitHub API. Can be called locally for testing with a tiny `main` function configuring an api token and commit count. <details> <summary>Example output</summary> ### Unit Tests *All tests passing* ### Instrumentation Tests | | [#7344](#7344) | [#7404](#7404) | [#7412](#7412) | [#7409](#7409) | [#7365](#7365) | Success Rate | | :--- | :---: | :---: | :---: | :---: | :---: | :--- | | firebase-database | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18049430908/job/51368583464) | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/18022175955/job/51281984677) | | | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/17951371470/job/51051886073) | ⛔ 33% | | firebase-common | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18049430908/job/51368583401) | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/18022175955/job/51281984633) | | | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/17951371470/job/51051886001) | ⛔ 66% | | firebase-config:bandwagoner | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18049430908/job/51368583437) | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18022175955/job/51281984627) | | | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/17951371470/job/51051886027) | ⛔ 66% | | firebase-functions | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18049430908/job/51368583469) | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18022175955/job/51281984675) | | | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/17951371470/job/51051886083) | ⛔ 66% | | firebase-inappmessaging | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18049430908/job/51368583442) | [✅](https://github.com/firebase/firebase-android-sdk/actions/runs/18022175955/job/51281984686) | | | [⛔](https://github.com/firebase/firebase-android-sdk/actions/runs/17951371470/job/51051886106) | ⛔ 66% | *+58 passing SDKs* </details>
1 parent 544b1a2 commit 66ee788

File tree

3 files changed

+444
-0
lines changed

3 files changed

+444
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.firebase.gradle.plugins.report
17+
18+
/**
19+
* @param sha Commit SHA.
20+
* @param pr GitHub PR number that was squashed to create this commit. Used only for display
21+
* purposes, does not affect logic.
22+
*/
23+
data class ReportCommit(val sha: String, val pr: Int)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.firebase.gradle.plugins.report
17+
18+
/**
19+
* Represents a single run of a test in CI. One unit/instrumentation test workflow run creates many
20+
* `TestReport`s, one for each tested SDK.
21+
*
22+
* @param name SDK name of the associated test run.
23+
* @param type What type of test result this is, either unit or instrumentation test.
24+
* @param status Conclusion status of the test run, `SUCCESS`/`FAILURE` for typical results, `OTHER`
25+
* for ongoing runs and unexpected data.
26+
* @param commit Commit SHA this test was run on.
27+
* @param url Link to the GHA test run info, including logs.
28+
*/
29+
data class TestReport(
30+
val name: String,
31+
val type: Type,
32+
val status: Status,
33+
val commit: String,
34+
val url: String,
35+
) {
36+
enum class Type {
37+
UNIT_TEST,
38+
INSTRUMENTATION_TEST,
39+
}
40+
41+
enum class Status {
42+
SUCCESS,
43+
FAILURE,
44+
OTHER,
45+
}
46+
}

0 commit comments

Comments
 (0)