Skip to content

chore(act): group log lines when running act tests inside gha#488

Merged
xnyo merged 15 commits intomainfrom
giuseppe/group-gha-logs
Feb 20, 2026
Merged

chore(act): group log lines when running act tests inside gha#488
xnyo merged 15 commits intomainfrom
giuseppe/group-gha-logs

Conversation

@xnyo
Copy link
Copy Markdown
Member

@xnyo xnyo commented Jan 8, 2026

Changes the log system for act tests when running inside GHA. Group all log lines (stdout + stderr) from each runner in its own GHA group. Since tests run in parallel, it's very hard to tell what's going on as each runner used to print to stdout as soon as possible.

Before: https://github.com/grafana/plugin-ci-workflows/actions/runs/20783693980/job/59687286367

After: https://github.com/grafana/plugin-ci-workflows/actions/runs/20817094834/job/59795443100?pr=488

@xnyo xnyo self-assigned this Jan 8, 2026
@xnyo xnyo added the github_actions Pull requests that update GitHub Actions code label Jan 8, 2026
@xnyo xnyo moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Jan 8, 2026
@xnyo xnyo marked this pull request as ready for review January 8, 2026 12:07
@xnyo xnyo requested review from a team as code owners January 8, 2026 12:07
@xnyo xnyo requested review from academo, s4kh and wbrowne January 8, 2026 12:07
@xnyo xnyo moved this from 🧑‍💻 In development to 🔬 In review in Grafana Catalog Team Jan 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the act test logging system to improve readability when running tests inside GitHub Actions. The changes buffer all log output (stdout and stderr) from each test runner and print them in collapsible GitHub Actions log groups, preventing interleaved output from parallel tests.

Changes:

  • Added WithName() option to configure custom runner names for logging
  • Modified stream handling to merge stdout and stderr for unified log grouping
  • Removed debug logging statements (t.Log, t.Logf) from test files
  • Implemented buffering system that groups logs by runner in GitHub Actions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/act/main_test.go Added WithName("toolcache-warmup") to warmup runner for clearer log identification
tests/act/main_smoke_test.go Removed debug t.Log() statement to reduce log clutter
tests/act/main_package_test.go Removed debug t.Logf() statements for cleaner output
tests/act/internal/act/act.go Core changes: added name field, merged stdout/stderr pipes, implemented log buffering and GHA grouping, added mutex for thread-safe group printing
Comments suppressed due to low confidence (1)

tests/act/internal/act/act.go:157

  • The name field is never initialized with a default value. When WithName() is not called, r.name will be an empty string, which will result in empty or malformed log output at lines 434, 447, 464, and 483.

The documentation at lines 48-49 states "By default, this is t.Name()", but this default is never set. Add initialization in NewRunner after line 152 to set r.name = t.Name() so that the field has a sensible default when WithName() is not explicitly called.

	r := &Runner{
		t:               t,
		uuid:            uuid.New(),
		gitHubToken:     ghToken,
		inGitHubActions: os.Getenv("GITHUB_ACTIONS") == "true",
		GCOM:            newGCOM(t),
		Argo: NewHTTPSpy(t, map[string]string{
			"uri": "https://mock-argo-workflows.example.com/workflows/grafana-plugins-cd/mock-workflow-id",
		}),
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/act/internal/act/act.go
Comment thread tests/act/internal/act/act.go Outdated
Comment thread tests/act/internal/act/act.go
@xnyo xnyo merged commit a4f2c26 into main Feb 20, 2026
13 checks passed
@xnyo xnyo deleted the giuseppe/group-gha-logs branch February 20, 2026 13:52
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants