Skip to content

Commit

Permalink
[ci] attach fail job HTML page URL to summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Avimitin committed Jan 7, 2025
1 parent 79197b5 commit 28032f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion script/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ trait ScriptModule extends ScalaModule with ScalafmtModule {
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0"
val oslib = ivy"com.lihaoyi::os-lib:0.10.0"
val upickle = ivy"com.lihaoyi::upickle:3.3.1"
val requests = ivy"com.lihaoyi::requests:0.9.0"

def scalaVersion = scala3
def scalacOptions = Seq("-new-syntax", "-deprecation")
override def ivyDeps = Agg(mainargs, oslib, upickle)
override def ivyDeps = Agg(mainargs, oslib, upickle, requests)
}

object emu extends ScriptModule {}
Expand Down
17 changes: 17 additions & 0 deletions script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,28 @@ object Main:
os.Path(sys.env("GITHUB_STEP_SUMMARY")),
failedTests.map(s => s"* ${s}\n").mkString
)
os.write.append(os.Path(sys.env("GITHUB_STEP_SUMMARY")), s"Job URL: ${findCurrentJobURL()}")
Logger.fatal(
s"${BOLD}${failedTests.length} tests failed${RESET}"
)
end runTests

// Search job HTML page by github run id
def findCurrentJobURL() =
val runID = sys.env("GITHUB_RUN_ID")
val jobName = sys.env("GITHUB_JOB")
Logger.info(s"Getting URL for Run ID: ${runID}, job ${jobName}")
val response = ujson.read(
requests.get.stream(s"https://api.github.com/repos/chipsalliance/t1/actions/runs/${runID}/jobs")
)
response
.obj("jobs")
.arr
.filter(job => job.obj("name").str == jobName)
.map(job => job.obj("html_url").str)
.head
end findCurrentJobURL

// PostCI do the below four things:
// * read default.json at .github/cases/$config/default.json
// * generate case information for each entry in default.json (cycle, run success)
Expand Down
2 changes: 1 addition & 1 deletion script/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let
./build.sc
];
};
millDepsHash = "sha256-QQ5gCbvovC55t9MmfCNTvNFdD6FcNqmLmfhT9qJhQQc=";
millDepsHash = "sha256-DAEgWFDUX22IfQ0N7j3icPjjrND3612leUT0qqXp+Zc=";
};

passthru.withLsp = self.overrideAttrs (old: {
Expand Down

0 comments on commit 28032f8

Please sign in to comment.