Skip to content

Commit 976e06f

Browse files
authored
[skip-changelog] Improved logging on GitHub Actions runners (using log folding commands) (#2414)
* Improve gh-actions output by folding integration-test output * Reduce build verbosity (not needed in GH actions logs)
1 parent 6c86fa2 commit 976e06f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: Taskfile.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tasks:
4848
desc: Build the Go code
4949
dir: '{{default "./" .GO_MODULE_PATH}}'
5050
cmds:
51-
- go build -v {{default "" .EXTRA_FLAGS}} {{.LDFLAGS}}
51+
- go build {{default "" .EXTRA_FLAGS}} {{.LDFLAGS}}
5252

5353
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
5454
go:cli-docs:

Diff for: internal/integrationtest/arduino-cli.go

+7
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ func (cli *ArduinoCLI) run(stdoutBuff, stderrBuff io.Writer, stdinBuff io.Reader
298298
if cli.cliConfigPath != nil {
299299
args = append([]string{"--config-file", cli.cliConfigPath.String()}, args...)
300300
}
301+
302+
// Github-actions workflow tags to fold log lines
303+
if os.Getenv("GITHUB_ACTIONS") != "" {
304+
fmt.Printf("::group::Running %s\n", strings.Join(args, " "))
305+
defer fmt.Println("::endgroup::")
306+
}
307+
301308
fmt.Println(color.HiBlackString(">>> Running: ") + color.HiYellowString("%s %s", cli.path, strings.Join(args, " ")))
302309
cliProc, err := executils.NewProcessFromPath(cli.convertEnvForExecutils(env), cli.path, args...)
303310
cli.t.NoError(err)

0 commit comments

Comments
 (0)