-
Notifications
You must be signed in to change notification settings - Fork 640
Create unit test report workflow #7422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ep/unit-test-report
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -141,6 +142,13 @@ abstract class BaseFirebaseLibraryPlugin : Plugin<Project> { | |
} | ||
} | ||
|
||
protected fun registerUnitTestReportTask(project: Project) = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This plugin is applied once per subproject. Since the task is not tied to any particular subproject, does it make sense to register it here? |
||
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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.OutputFile | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
abstract class UnitTestReportTask: DefaultTask() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation |
||
@get:OutputFile abstract val outputFile: RegularFileProperty | ||
|
||
@get:Input abstract val commitCount: Property<Integer> | ||
|
||
@get:Input abstract val apiToken: Property<String> | ||
|
||
@TaskAction | ||
fun make() { | ||
UnitTestReport(apiToken.get()).createReport(outputFile.asFile.get(), commitCount.get().toInt()) | ||
} | ||
} |
There was a problem hiding this comment.
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?