Universal Go CI Tool - #23538
Conversation
|
👋 kalverra, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
|
ee01cd9 to
5ebc9f7
Compare
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM
Introduces a new tools/ci Go-based CLI intended to centralize CI helper logic (matrix generation, GitHub Actions outputs, version reporting) and replaces repeated gotestsum-install snippets with reusable composite actions, while extending ci-core to run tools unit tests from a generated matrix.
Changes:
- Added
tools/ciGo module with Cobra CLI (version,tools matrix) plus internal helpers (ghaction, target discovery/matrix filtering) and tests. - Updated
ci-coreto build/cache the CI CLI, generate a tools test matrix, and run tools tests as a separate matrix job. - Replaced inline gotestsum installation/caching in multiple workflows with a new
setup-gotestsumcomposite action; added asetup-ci-clicomposite action.
Areas for scrupulous human review
tools/ci/cmd/tools.go:getGitChangedFiles+ matrix generation path (error handling and correctness in shallow checkouts / PR contexts)..github/workflows/ci-core.ymlfilter job’s “Generate tools test matrix” step (ensuring the matrix is non-empty when tools changes occur, and that git refs/history are sufficient)..github/actions/setup-ci-cli/action.ymlcache key correctness across runner architectures.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ci/README.md | Documents the new unified CI CLI tool and basic usage/testing. |
| tools/ci/main.go | CLI entrypoint calling the Cobra root command. |
| tools/ci/internal/tools/target.go | Discovers tool test targets and computes a filtered matrix based on changes/events. |
| tools/ci/internal/tools/target_test.go | Unit tests for target discovery and matrix filtering behavior. |
| tools/ci/internal/ghaction/ghaction.go | Wrapper for GitHub Actions outputs/env/summary and grouping. |
| tools/ci/internal/ghaction/ghaction_test.go | Tests for GitHub Actions wrapper behavior and fallbacks. |
| tools/ci/go.mod | New Go module for the CI CLI and its dependencies. |
| tools/ci/go.sum | Dependency checksums for the new CI CLI module. |
| tools/ci/cmd/root.go | Root Cobra command and repo-root discovery helper. |
| tools/ci/cmd/version.go | ci version subcommand with text/JSON output. |
| tools/ci/cmd/version_test.go | Tests for help output, version output, and repo-root discovery. |
| tools/ci/cmd/tools.go | ci tools matrix command to emit matrix output (stdout and/or GHA outputs). |
| tools/ci/cmd/tools_test.go | Tests for matrix JSON output, GHA output writing, and change filtering. |
| tools/ci/AGENTS.md | Adds development rules/conventions for tools/ci. |
| GNUmakefile | Adds make ci-cli target to build tools/ci binary locally. |
| .github/workflows/ci-core.yml | Generates tools matrix via ci and adds a tools-tests matrix job. |
| .github/actions/setup-ci-cli/action.yml | Composite action to build/cache tools/ci binary and export it to PATH. |
| .github/actions/setup-gotestsum/action.yml | Composite action to cache/install gotestsum and add it to PATH. |
| .github/workflows/cre-wf-caching-test.yml | Switches to setup-gotestsum composite action. |
| .github/workflows/cre-system-tests.yaml | Switches to setup-gotestsum composite action. |
| .github/workflows/cre-soak-memory-leak.yml | Switches to setup-gotestsum composite action. |
| .github/workflows/cre-regression-system-tests.yaml | Switches to setup-gotestsum composite action. |
| .github/workflows/cre-mixed-env-tests.yaml | Switches to setup-gotestsum composite action. |
| .github/workflows/ccip-system-tests.yaml | Switches to setup-gotestsum composite action. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
77df296 to
6e6188f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.
Suppressed comments (2)
tools/ci/internal/ghaction/ghaction_test.go:73
- This fallback test is skipped in CI due to GITHUB_ENV being set. It can be made hermetic by clearing GITHUB_ENV via t.Setenv and running unconditionally in CI.
func TestGHAction_SetEnv_FallbackStdout(t *testing.T) {
if os.Getenv("CI") == "true" || os.Getenv("GITHUB_ACTIONS") == "true" {
t.Skip("skipping in CI: GITHUB_ENV is set in CI environment")
}
t.Parallel()
var stdout bytes.Buffer
act := ghaction.New(&stdout, "", "")
tools/ci/internal/ghaction/ghaction_test.go:104
- This fallback test is skipped in CI due to GITHUB_STEP_SUMMARY being set. It can run in CI by clearing GITHUB_STEP_SUMMARY via t.Setenv before constructing the action context.
func TestGHAction_AddStepSummary_FallbackStdout(t *testing.T) {
if os.Getenv("CI") == "true" || os.Getenv("GITHUB_ACTIONS") == "true" {
t.Skip("skipping in CI: GITHUB_STEP_SUMMARY is set in CI environment")
}
t.Parallel()
var stdout bytes.Buffer
act := ghaction.NewWithOptions(&stdout, "", "", "")
|
| ./coverage.txt | ||
| retention-days: 7 | ||
|
|
||
| tools-tests: |
There was a problem hiding this comment.
I'm curious if it makes sense for this to live in it's own workflow? We have ci-deployments now, so maybe tools should be in ci-tools?
| // Target represents a runnable Go test target in the tools directory. | ||
| type Target struct { |
There was a problem hiding this comment.
I haven't seen the rest of the PR stack but this seem like it could/should be generic enough to apply to all go test targets?




Intent
Create a Go tool to use in CI instead of ad-hoc bash scripts and complex YAML. Much easier to understand and test, and maybe a little faster to execute.
Stack created with GitHub Stacks CLI • Give Feedback 💬