Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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: 35 additions & 0 deletions .github/workflows/unit-test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Firebase AI Daily Tests

on:
schedule:
- cron: 51 8 * * * # Runs automatically once a day
workflow_dispatch: # Allow triggering the workflow manually

permissions:
contents: read
issues: write

jobs:
dailies:
name: "Unit Test Report"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true

- name: Set up JDK 17
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: temurin
cache: gradle

- name: Generate Test Report
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew generateTestReport

- name: Update tracking issue
run: gh issue edit 7421 --body-file test-report.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it meant to be hardcoded to 7421?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, #7421 has been created for this purpose

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.google.firebase.gradle.plugins

import com.android.build.gradle.LibraryExtension
import com.google.firebase.gradle.plugins.ci.Coverage
import com.google.firebase.gradle.plugins.report.UnitTestReportTask
import com.google.firebase.gradle.plugins.services.GMavenService
import java.io.File
import java.nio.file.Paths
Expand Down Expand Up @@ -141,6 +142,13 @@ abstract class BaseFirebaseLibraryPlugin : Plugin<Project> {
}
}

protected fun registerUnitTestReportTask(project: Project) =
project.tasks.register<UnitTestReportTask>("generateTestReport") {
outputFile.set(project.file("test-report.md"))
commitCount.set(8 as Integer)
apiToken.set(System.getenv("GH_TOKEN"))
}

protected fun getApiInfo(
project: Project,
srcDirs: ConfigurableFileCollection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class FirebaseAndroidLibraryPlugin : BaseFirebaseLibraryPlugin() {
}

setupMetalavaSemver(project, firebaseLibrary)
registerUnitTestReportTask(project)
}

private fun setupApiInformationAnalysis(project: Project, android: LibraryExtension) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class FirebaseJavaLibraryPlugin : BaseFirebaseLibraryPlugin() {
}

setupMetalavaSemver(project, firebaseLibrary)
registerUnitTestReportTask(project)
}

private fun setupApiInformationAnalysis(project: Project) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.firebase.gradle.plugins.report

data class ReportCommit(val sha: String, val pr: Int)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.firebase.gradle.plugins.report

data class TestReport(
val name: String,
val type: Type,
val status: Status,
val commit: String,
val url: String,
) {
enum class Type {
UNIT_TEST,
INSTRUMENTATION_TEST,
}

enum class Status {
SUCCESS,
FAILURE,
OTHER,
}
}
Loading
Loading