File tree 2 files changed +37
-1
lines changed
zpa-checks/src/integrationTest/kotlin/org/sonar/plsqlopen/it
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 32
32
run : ./gradlew build publishToMavenLocal
33
33
34
34
- name : Run zpa-checks integration tests
35
- run : ./gradlew :zpa-checks:integrationTest
35
+ run : |
36
+ ./gradlew :zpa-checks:integrationTest
37
+ cat zpa-checks/build/integrationTest/progress-summary.md >> $GITHUB_STEP_SUMMARY
36
38
37
39
- name : Build custom rules example
38
40
run : ./gradlew build -p plsql-custom-rules
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.util.DefaultIndenter
23
23
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
24
24
import com.fasterxml.jackson.databind.JsonNode
25
25
import com.fasterxml.jackson.databind.ObjectMapper
26
+ import org.junit.jupiter.api.AfterAll
26
27
import org.junit.jupiter.api.Test
27
28
import org.junit.jupiter.api.fail
28
29
import org.sonar.plsqlopen.checks.CheckList
@@ -244,6 +245,39 @@ class PlSqlRulingTest {
244
245
)
245
246
}
246
247
}
248
+
249
+ summary.add(SummaryItem (project, files.size, issues.filter { it.check is ParsingErrorCheck }.size))
247
250
}
248
251
252
+ companion object {
253
+ private val summary = mutableListOf<SummaryItem >()
254
+
255
+ @AfterAll
256
+ @JvmStatic
257
+ fun writeSummary () {
258
+ val output = File (" build/integrationTest/progress-summary.md" )
259
+ output.parentFile.mkdirs()
260
+ output.writeText(" | Project | Files | Parsing Errors | % Success | Status |\n | --- | --- | --- | --- | --- |\n " )
261
+
262
+ for (item in summary.sortedWith(compareByDescending<SummaryItem > { it.parsingErrors }.thenBy { it.name })) {
263
+ val successPercentage = ((item.files - item.parsingErrors).toDouble() / item.files) * 100
264
+ val status = if (item.parsingErrors > 0 ) " ❌" else " ✅"
265
+ output.appendText(
266
+ " | ${item.name} | ${item.files} | ${item.parsingErrors} | ${
267
+ String .format(
268
+ " %.2f" ,
269
+ successPercentage
270
+ )
271
+ } % | $status |\n "
272
+ )
273
+ }
274
+ }
275
+ }
276
+
277
+ data class SummaryItem (
278
+ val name : String ,
279
+ val files : Int ,
280
+ val parsingErrors : Int ,
281
+ )
282
+
249
283
}
You can’t perform that action at this time.
0 commit comments