From 1e83ba4b872343390218eef70af7e1f2311dfa80 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 15 Oct 2024 20:56:04 -0400 Subject: [PATCH 1/5] fix(parser/resultdetail): format on empty error --- internal/parser/resultdetail/parser.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/parser/resultdetail/parser.go b/internal/parser/resultdetail/parser.go index 0d946c8..eb15bb1 100644 --- a/internal/parser/resultdetail/parser.go +++ b/internal/parser/resultdetail/parser.go @@ -33,6 +33,9 @@ func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) ( comment += fmt.Sprintf("Exit Status: `%d`\n", result.ExitStatus) } if conf.ShowError { + if result.Error == "" { + result.Error = "nil" + } comment += fmt.Sprintf("Error: `%s`\n", result.Error) } if conf.ShowTime { From e44537ea957a1757777838d6013e88d26d9997fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B3=8A=E6=98=8E518370910136?= Date: Thu, 17 Oct 2024 03:15:40 +0800 Subject: [PATCH 2/5] feat(cmd/joj3): issue with actor [force build] --- cmd/joj3/teapot/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/joj3/teapot/run.go b/cmd/joj3/teapot/run.go index 329c221..d6fc626 100644 --- a/cmd/joj3/teapot/run.go +++ b/cmd/joj3/teapot/run.go @@ -77,7 +77,7 @@ func Run(conf *conf.Conf) error { if !conf.Teapot.SkipIssue { err := execCommand("joint-teapot", []string{ "joj3-create-result-issue", envFilePath, conf.Stage.OutputPath, - repoName, runNumber, conf.Name, + repoName, runNumber, conf.Name, actor, }) if err != nil { issueErr = err From 7ff6dfb0024fb98e0be27cd420b9eb1a61f87cdf Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Wed, 16 Oct 2024 16:15:54 -0400 Subject: [PATCH 3/5] fix(parser/clangtidy): ignore empty lines --- internal/parser/clangtidy/convert.go | 4 ++++ internal/parser/clangtidy/parser.go | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/parser/clangtidy/convert.go b/internal/parser/clangtidy/convert.go index 88e87e3..c6ea7c3 100644 --- a/internal/parser/clangtidy/convert.go +++ b/internal/parser/clangtidy/convert.go @@ -6,6 +6,7 @@ import ( "path/filepath" "regexp" "strconv" + "strings" ) type Level int @@ -68,6 +69,9 @@ func levelFromString(levelString string) Level { } func isIgnored(line string) bool { + if strings.TrimSpace(line) == "" { + return true + } ignoreRegex := regexp.MustCompile("^error:.*$") return ignoreRegex.MatchString(line) } diff --git a/internal/parser/clangtidy/parser.go b/internal/parser/clangtidy/parser.go index 51661ed..85ca466 100644 --- a/internal/parser/clangtidy/parser.go +++ b/internal/parser/clangtidy/parser.go @@ -24,11 +24,6 @@ type ClangTidy struct{} func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { stdout := executorResult.Files["stdout"] stderr := executorResult.Files["stderr"] - - lines := strings.SplitAfter(stdout, "\n") - messages := ParseLines(lines, conf) - formattedMessages := Format(messages) - if executorResult.Status != stage.Status(envexec.StatusAccepted) { if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) && (executorResult.ExitStatus == 1)) { @@ -41,6 +36,9 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { } } } + lines := strings.SplitAfter(stdout, "\n") + messages := ParseLines(lines, conf) + formattedMessages := Format(messages) score, comment := GetResult(formattedMessages, conf) return stage.ParserResult{ Score: score, From fcc1f1856f48696c06492f8e089ead01b1fab412 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Wed, 16 Oct 2024 21:00:03 -0400 Subject: [PATCH 4/5] feat(cmd/joj3): pass commit hash to teapot [force build] --- cmd/joj3/teapot/run.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/joj3/teapot/run.go b/cmd/joj3/teapot/run.go index d6fc626..3287b01 100644 --- a/cmd/joj3/teapot/run.go +++ b/cmd/joj3/teapot/run.go @@ -21,8 +21,7 @@ func Run(conf *conf.Conf) error { os.Setenv("LOG_FILE_PATH", conf.Teapot.LogPath) os.Setenv("_TYPER_STANDARD_TRACEBACK", "1") envFilePath := "/home/tt/.config/teapot/teapot.env" - // TODO: pass sha to joint-teapot - // sha := os.Getenv("GITHUB_SHA") + sha := os.Getenv("GITHUB_SHA") actor := os.Getenv("GITHUB_ACTOR") repository := os.Getenv("GITHUB_REPOSITORY") runNumber := os.Getenv("GITHUB_RUN_NUMBER") @@ -55,7 +54,7 @@ func Run(conf *conf.Conf) error { err := execCommand("joint-teapot", []string{ "joj3-scoreboard", envFilePath, conf.Stage.OutputPath, actor, conf.Teapot.GradingRepoName, repoName, runNumber, - conf.Teapot.ScoreboardPath, conf.Name, + conf.Teapot.ScoreboardPath, conf.Name, sha, }) if err != nil { scoreboardErr = err @@ -65,7 +64,7 @@ func Run(conf *conf.Conf) error { err := execCommand("joint-teapot", []string{ "joj3-failed-table", envFilePath, conf.Stage.OutputPath, actor, conf.Teapot.GradingRepoName, repoName, runNumber, - conf.Teapot.FailedTablePath, conf.Name, + conf.Teapot.FailedTablePath, conf.Name, sha, }) if err != nil { failedTableErr = err @@ -77,7 +76,7 @@ func Run(conf *conf.Conf) error { if !conf.Teapot.SkipIssue { err := execCommand("joint-teapot", []string{ "joj3-create-result-issue", envFilePath, conf.Stage.OutputPath, - repoName, runNumber, conf.Name, actor, + actor, repoName, runNumber, conf.Name, sha, }) if err != nil { issueErr = err From ff0b0957eb8d4aea471312f1d4e9f4b4aa335e33 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Wed, 16 Oct 2024 23:40:39 -0400 Subject: [PATCH 5/5] refactor(cmd/joj3): backward compatible arg order [force build] --- cmd/joj3/teapot/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/joj3/teapot/run.go b/cmd/joj3/teapot/run.go index 3287b01..7c2a240 100644 --- a/cmd/joj3/teapot/run.go +++ b/cmd/joj3/teapot/run.go @@ -76,7 +76,7 @@ func Run(conf *conf.Conf) error { if !conf.Teapot.SkipIssue { err := execCommand("joint-teapot", []string{ "joj3-create-result-issue", envFilePath, conf.Stage.OutputPath, - actor, repoName, runNumber, conf.Name, sha, + repoName, runNumber, conf.Name, actor, sha, }) if err != nil { issueErr = err