Add links in Checks panel for test/lint tasks (#12222)
* Add lints in Checks panel for test/lint tasks * Switch to custom task * Rename github tasksmaster
parent
0df234cf76
commit
da87727c61
16
build.gradle
16
build.gradle
|
@ -1,5 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
// This logic is duplicated in the allprojects block: I don't know how to fix that.
|
// This logic is duplicated in the allprojects block: I don't know how to fix that.
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -181,9 +183,21 @@ tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class) {
|
||||||
exclude("**/tmp/**")
|
exclude("**/tmp/**")
|
||||||
}
|
}
|
||||||
|
|
||||||
task listRepositories {
|
tasks.register("listRepositories") {
|
||||||
doLast {
|
doLast {
|
||||||
println "Repositories:"
|
println "Repositories:"
|
||||||
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
|
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("githubTestDetails", GithubDetailsTask) {
|
||||||
|
text = "### [Unit Test Results](/reports/test/testGeckoNightlyDebugUnitTest/index.html)"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("githubLintDetektDetails", GithubDetailsTask) {
|
||||||
|
text = "### [Detekt Results](/reports/detekt.html)"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
|
||||||
|
text = "### [Android Lint Results](/reports/lint-results-geckoNightlyDebug.html)"
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix.gradle.tasks
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to write to the "customCheckRunText.md" file for Taskcluster.
|
||||||
|
* Taskcluster uses this file to populate the "Details" section in the GitHub Checks panel UI.
|
||||||
|
*/
|
||||||
|
open class GithubDetailsTask : DefaultTask() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text to display in the Github Checks panel under "Details". Any markdown works here.
|
||||||
|
* The text is written to a markdown file which is used by Taskcluster.
|
||||||
|
* Links are automatically rewritten to point to the correct Taskcluster URL.
|
||||||
|
*/
|
||||||
|
@Input
|
||||||
|
var text: String = ""
|
||||||
|
|
||||||
|
private val detailsFile = File("/builds/worker/github/customCheckRunText.md")
|
||||||
|
private val suffix = "\n\n_(404 if compilation failed)_"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Captures the link name and URL in a markdown link.
|
||||||
|
* i.e. "### [Hello](/world.html)" -> "/world.html"
|
||||||
|
*/
|
||||||
|
private val markdownLinkRegex = """\[(.*)]\((.*)\)""".toRegex()
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
fun writeFile() {
|
||||||
|
val taskId = System.getenv("TASK_ID")
|
||||||
|
val url = "https://firefoxci.taskcluster-artifacts.net/$taskId/0/public"
|
||||||
|
val replaced = text.replace(markdownLinkRegex) { match ->
|
||||||
|
val (_, linkName, linkUrl) = match.groupValues
|
||||||
|
"[$linkName](${url + linkUrl})"
|
||||||
|
}
|
||||||
|
|
||||||
|
project.mkdir("/builds/worker/github")
|
||||||
|
detailsFile.writeText(replaced + suffix)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -47,7 +47,7 @@ jobs:
|
||||||
description: 'Running detekt over all modules'
|
description: 'Running detekt over all modules'
|
||||||
run:
|
run:
|
||||||
using: gradlew
|
using: gradlew
|
||||||
gradlew: [detekt]
|
gradlew: [detekt, githubLintDetektDetails]
|
||||||
treeherder:
|
treeherder:
|
||||||
symbol: detekt
|
symbol: detekt
|
||||||
worker:
|
worker:
|
||||||
|
@ -55,6 +55,9 @@ jobs:
|
||||||
- name: public/reports
|
- name: public/reports
|
||||||
path: /builds/worker/checkouts/src/build/reports
|
path: /builds/worker/checkouts/src/build/reports
|
||||||
type: directory
|
type: directory
|
||||||
|
- name: public/github
|
||||||
|
path: /builds/worker/github
|
||||||
|
type: directory
|
||||||
ktlint:
|
ktlint:
|
||||||
description: 'Running ktlint over all modules'
|
description: 'Running ktlint over all modules'
|
||||||
run:
|
run:
|
||||||
|
@ -66,7 +69,7 @@ jobs:
|
||||||
description: 'Running lint over all modules'
|
description: 'Running lint over all modules'
|
||||||
run:
|
run:
|
||||||
using: gradlew
|
using: gradlew
|
||||||
gradlew: ['lintGeckoNightlyDebug']
|
gradlew: ['lintGeckoNightlyDebug', 'githubLintAndroidDetails']
|
||||||
treeherder:
|
treeherder:
|
||||||
symbol: lint
|
symbol: lint
|
||||||
worker:
|
worker:
|
||||||
|
@ -74,3 +77,6 @@ jobs:
|
||||||
- name: public/reports
|
- name: public/reports
|
||||||
path: /builds/worker/checkouts/src/app/build/reports
|
path: /builds/worker/checkouts/src/app/build/reports
|
||||||
type: directory
|
type: directory
|
||||||
|
- name: public/github
|
||||||
|
path: /builds/worker/github
|
||||||
|
type: directory
|
||||||
|
|
|
@ -40,7 +40,11 @@ jobs:
|
||||||
geckoview-engine: geckoNightly
|
geckoview-engine: geckoNightly
|
||||||
code-review: true
|
code-review: true
|
||||||
run:
|
run:
|
||||||
gradlew: ['clean', '-Pcoverage', 'jacocoGeckoNightlyDebugTestReport']
|
gradlew:
|
||||||
|
- 'clean'
|
||||||
|
- '-Pcoverage'
|
||||||
|
- 'jacocoGeckoNightlyDebugTestReport'
|
||||||
|
- 'githubTestDetails'
|
||||||
# post-gradlew:
|
# post-gradlew:
|
||||||
# - ['automation/taskcluster/upload_coverage_report.sh']
|
# - ['automation/taskcluster/upload_coverage_report.sh']
|
||||||
secrets:
|
secrets:
|
||||||
|
@ -59,3 +63,6 @@ jobs:
|
||||||
- name: public/reports/test
|
- name: public/reports/test
|
||||||
path: /builds/worker/checkouts/src/app/build/reports/tests
|
path: /builds/worker/checkouts/src/app/build/reports/tests
|
||||||
type: directory
|
type: directory
|
||||||
|
- name: public/github
|
||||||
|
path: /builds/worker/github
|
||||||
|
type: directory
|
||||||
|
|
Loading…
Reference in New Issue