improve sonarqube action
This commit is contained in:
11
.github/workflows/tests.yml
vendored
11
.github/workflows/tests.yml
vendored
@@ -126,11 +126,20 @@ jobs:
|
|||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
restore-keys: ${{ runner.os }}-sonar
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
with:
|
||||||
|
gradle-version: 6.8
|
||||||
|
arguments: test
|
||||||
|
|
||||||
- name: Build and analyze
|
- name: Build and analyze
|
||||||
|
uses: eskatos/gradle-command-action@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: ./gradlew build sonarqube --info
|
with:
|
||||||
|
gradle-version: 6.8
|
||||||
|
arguments: sonarqube --info
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
needs: build
|
needs: build
|
||||||
|
|||||||
@@ -181,8 +181,6 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.sonarqube.configure {
|
tasks.sonarqube.configure {
|
||||||
dependsOn(tasks.test)
|
|
||||||
dependsOn(tasks.detekt)
|
|
||||||
dependsOn(tasks.jacocoTestReport)
|
dependsOn(tasks.jacocoTestReport)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,6 +311,7 @@ tasks.register("testWithDependencies", Test::class) {
|
|||||||
dependsOn(tasks.named("testComposeUp"))
|
dependsOn(tasks.named("testComposeUp"))
|
||||||
dependsOn(tasks.ktlintCheck)
|
dependsOn(tasks.ktlintCheck)
|
||||||
dependsOn(testSql)
|
dependsOn(testSql)
|
||||||
|
finalizedBy(tasks.sonarqube) // report is always generated after tests run
|
||||||
}
|
}
|
||||||
tasks.register("testArticles", Test::class) {
|
tasks.register("testArticles", Test::class) {
|
||||||
group = "tests"
|
group = "tests"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.net.URL
|
|||||||
fun ValidationBuilder<String>.isUrl() =
|
fun ValidationBuilder<String>.isUrl() =
|
||||||
addConstraint("is not url") {
|
addConstraint("is not url") {
|
||||||
try {
|
try {
|
||||||
val url = URL(it)
|
URL(it)
|
||||||
true
|
true
|
||||||
} catch (e: MalformedURLException) {
|
} catch (e: MalformedURLException) {
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user