From 3408b3ece5e53510873df7b52d70e7ebc038a24c Mon Sep 17 00:00:00 2001 From: Avimitin Date: Sat, 5 Oct 2024 17:05:29 +0800 Subject: [PATCH] [ci] add urg report to ci Signed-off-by: Avimitin --- .github/workflows/vcs.yml | 3 +++ script/ci/src/Main.scala | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/.github/workflows/vcs.yml b/.github/workflows/vcs.yml index 01c211679..1b36c6c2f 100644 --- a/.github/workflows/vcs.yml +++ b/.github/workflows/vcs.yml @@ -101,9 +101,12 @@ jobs: - name: "Print step summary" run: | nix run ".#ci-helper" -- postCI \ + --urg-report-file-path ./urg-report.md \ --cycle-update-file-path ./cycle-update.md \ --failed-tests-file-path ./failed-tests.md \ --emu-type vcs + cat ./urg-report.md >> $GITHUB_STEP_SUMMARY + echo >> $GITHUB_STEP_SUMMARY cat ./cycle-update.md >> $GITHUB_STEP_SUMMARY echo >> $GITHUB_STEP_SUMMARY cat ./failed-tests.md >> $GITHUB_STEP_SUMMARY diff --git a/script/ci/src/Main.scala b/script/ci/src/Main.scala index 127c6d497..75ccbc036 100644 --- a/script/ci/src/Main.scala +++ b/script/ci/src/Main.scala @@ -214,6 +214,10 @@ object Main: name = "cycle-update-file-path", doc = "specify the cycle update markdown file output path" ) cycleUpdateFilePath: String, + @arg( + name = "urg-report-file-path", + doc = "specify the urg report markdown file output path" + ) urgReportFilePath: Option[String], @arg( name = "emu-type", doc = "Specify emulation type" @@ -231,6 +235,9 @@ object Main: "## Cycle Update\n" ) + if urgReportFilePath.nonEmpty then + os.write(os.Path(urgReportFilePath.get, os.pwd), "# Coverage report\n") + os.walk(os.pwd / ".github" / caseDir) .filter(_.last == "default.json") .foreach: file => @@ -281,6 +288,23 @@ object Main: allCycleUpdates.mkString("\n") + "\n" ) + if urgReportFilePath.nonEmpty then + Logger.info("Filtering urg report") + val finalMdPath = os.Path(urgReportFilePath.get, os.pwd) + val urgAssertFile = emuResultPath / "urgReport" / "asserts.txt" + val heading = "^Summary for Cover Properties$".r + val coverSummaryStr = + os.read(urgAssertFile) + .lines() + .dropWhile(!heading.matches(_)) + .takeWhile(_.distinct != "-") + .toArray + .mkString("\n") + os.write.append(finalMdPath, s"### Coverage for $config \n") + os.write.append(finalMdPath, "```text\n") + os.write.append(finalMdPath, coverSummaryStr) + os.write.append(finalMdPath, "\n```\n") + os.write.over(file, ujson.write(cycleRecord, indent = 2)) end postCI