-
-
Notifications
You must be signed in to change notification settings - Fork 133
Fix: Reduce Go build cache size by using selective coverage instrumentation #1444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…tation - Change -coverpkg=./... to -coverpkg=github.com/cloudposse/atmos/... - This prevents instrumentation of all 853 external dependencies - Reduces cache size from 4GB+ to under 1GB - Fixes timeout issues in GitHub Actions for Linux builds - Coverage still tracks all Atmos code, just not external deps The issue was that -coverpkg=./... was instrumenting ALL dependencies (including google.golang.org/api at 336MB, aws-sdk-go at 322MB, etc.) for coverage tracking, causing the Go build cache to exceed 4GB and timeout during restoration in GitHub Actions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
📝 WalkthroughWalkthroughUpdated the Makefile’s testacc-cover target by changing the Go test coverage flag -coverpkg from ./... to github.com/cloudposse/atmos/.... No other targets or flags were modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Makefile (1)
62-66
: Use module-derived coverpkg, atomic coverage mode, and tighten mock filter.
- Avoid hardcoding the module path; derive it to keep forks/renames working.
- Prefer -covermode=atomic for accurate concurrent coverage (and Codecov friendliness).
- Narrow the grep to exclude only _mock.go files and drop the needless cat.
Add near the top (outside this hunk):
MODULE ?= $(shell go list -m)
Apply this diff in this target:
- go test $(TEST) -v -coverpkg=github.com/cloudposse/atmos/... $(TESTARGS) -timeout 40m -coverprofile=coverage.out.tmp - cat coverage.out.tmp | grep -v "mock_" > coverage.out + go test $(TEST) -v -covermode=atomic -coverpkg=$(MODULE)/... $(TESTARGS) -timeout 40m -coverprofile=coverage.out.tmp + grep -vE '/mock_.*\.go:' coverage.out.tmp > coverage.out
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Makefile
(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: aknysh
PR: cloudposse/atmos#768
File: internal/exec/vendor_model_component.go:3-20
Timestamp: 2024-11-18T13:59:10.824Z
Learning: When replacing significant dependencies like `go-getter` that require extensive changes, prefer to address them in separate PRs.
Learnt from: CR
PR: cloudposse/atmos#0
File: AGENTS.md:0-0
Timestamp: 2025-09-02T14:44:18.329Z
Learning: Run `make testacc-cover` before committing
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T19:59:52.081Z
Learning: Applies to **/*.go : Target >80% coverage on new/changed lines and include comprehensive unit tests for new features.
📚 Learning: 2025-09-02T14:44:18.329Z
Learnt from: CR
PR: cloudposse/atmos#0
File: AGENTS.md:0-0
Timestamp: 2025-09-02T14:44:18.329Z
Learning: Run `make testacc-cover` before committing
Applied to files:
Makefile
📚 Learning: 2025-07-01T02:22:25.901Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: CI should run unit tests, integration tests, golangci-lint, and coverage reporting
Applied to files:
Makefile
📚 Learning: 2025-07-01T02:22:25.901Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Include integration tests for command flows
Applied to files:
Makefile
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Build (macos-latest, macos)
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Summary
🔇 Additional comments (2)
Makefile (2)
64-64
: Selective coverpkg fixes cache bloat — good change.Limiting instrumentation to the module path is the right call to shrink the build cache and speed up CI. Nice.
62-66
: Instrumentation scope and module path verified. Module path isgithub.1485827954.workers.dev/cloudposse/atmos
and coverage instrumentation includes exactly all 51 local packages (matching./...
).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1444 +/- ##
==========================================
+ Coverage 55.93% 55.97% +0.04%
==========================================
Files 274 274
Lines 28928 28928
==========================================
+ Hits 16181 16193 +12
+ Misses 10955 10941 -14
- Partials 1792 1794 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
what
-coverpkg=./...
to-coverpkg=github.com/cloudposse/atmos/...
in the Makefile'stestacc-cover
targetwhy
-coverpkg=./...
because it was instrumenting all 853 dependenciesmake testacc-cover
with full coverage instrumentation (for Codecov upload)references
github.com/cloudposse/atmos/...
) still provides accurate coverage for our code while excluding external dependencies🤖 Generated with Claude Code
Summary by CodeRabbit