feat(CC-0003): add minimal GitHub Actions CI workflow#4
feat(CC-0003): add minimal GitHub Actions CI workflow#4
Conversation
- Add .github/workflows/ci.yaml with three parallel jobs: lint, test, and test-integration running on push to main and PRs - Pin all GitHub Actions to full commit SHAs for supply chain security (checkout, setup-go, golangci-lint-action) - Use golangci-lint-action v9 (v2.10) for linting against the Go workspace root without a separate setup-go step - Read Go version from go.work via actions/setup-go for test jobs with default module caching enabled - Apply least-privilege permissions (contents: read) and add concurrency group with cancel-in-progress to save CI resources - Implement test-integration Makefile target to run go test with -tags=integration across all workspace modules - Add TODO for KUBEBUILDER_ASSETS setup step when envtest-based integration tests are introduced (CC-0002/S002) - Add reference documentation in docs/ci-workflow.md covering triggers, jobs, Go setup convention, and dependencies AI-assisted: Claude Code On-behalf-of: @SAP christian.berendt@sap.com Signed-off-by: Christian Berendt <berendt@23technologies.cloud>
Reviewer's GuideAdds a minimal GitHub Actions CI workflow with parallel lint, unit test, and integration test jobs wired to existing Makefile targets, using pinned action SHAs, workspace-based Go version detection, least-privilege permissions, and accompanying documentation. Flow diagram for the updated Makefile test_integration targetflowchart TD
Start[Start test_integration target] --> InitLoop[Read ALL_MODULE_DIRS]
InitLoop --> ForEachDir{More module directories?}
ForEachDir -->|yes| EchoDir[Print Integration testing dir]
EchoDir --> CdDir[cd into module directory]
CdDir --> RunGoTest[Run go test -tags=integration ./...]
RunGoTest --> TestSuccess{go test exit code 0?}
TestSuccess -->|no| ExitError[Exit 1]
TestSuccess -->|yes| NextIter[Next directory]
NextIter --> ForEachDir
ForEachDir -->|no| Done[All integration tests completed successfully]
style ExitError fill:#fdd,stroke:#f00
style Done fill:#dfd,stroke:#080
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
test-integrationMakefile target iterates over$(ALL_MODULE_DIRS)whiledocs/ci-workflow.mddescribes these targets in terms ofOPERATORS; consider aligning the variable/terminology so CI behavior matches the documented module set. - Given that
test-integrationdepends onKUBEBUILDER_ASSETSand a future S002 implementation, you may want to gate thetest-integrationCI job behind a condition (e.g., env flag or path filter) to avoid having the main CI pipeline blocked by a known-not-yet-implemented integration setup.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `test-integration` Makefile target iterates over `$(ALL_MODULE_DIRS)` while `docs/ci-workflow.md` describes these targets in terms of `OPERATORS`; consider aligning the variable/terminology so CI behavior matches the documented module set.
- Given that `test-integration` depends on `KUBEBUILDER_ASSETS` and a future S002 implementation, you may want to gate the `test-integration` CI job behind a condition (e.g., env flag or path filter) to avoid having the main CI pipeline blocked by a known-not-yet-implemented integration setup.
## Individual Comments
### Comment 1
<location path=".github/workflows/ci.yaml" line_range="27" />
<code_context>
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
+ - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
+ with:
+ version: v2.10
+
+ test:
</code_context>
<issue_to_address>
**issue (bug_risk):** The golangci-lint `version` input looks off and may not match actual released versions, causing the lint job to fail.
This `version` value is for the golangci-lint binary, not the action. golangci-lint releases use tags like `v1.xx.x` (e.g. `v1.59.1`), and there is no `v2.10`, so this will likely fail to resolve. Please update it to a valid golangci-lint release (or `latest`) and keep it aligned with the rest of the toolchain’s expected version.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
.github/workflows/ci.yaml
Outdated
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | ||
| with: | ||
| version: v2.10 |
There was a problem hiding this comment.
issue (bug_risk): The golangci-lint version input looks off and may not match actual released versions, causing the lint job to fail.
This version value is for the golangci-lint binary, not the action. golangci-lint releases use tags like v1.xx.x (e.g. v1.59.1), and there is no v2.10, so this will likely fail to resolve. Please update it to a valid golangci-lint release (or latest) and keep it aligned with the rest of the toolchain’s expected version.
Gate the test-integration CI job behind a ENABLE_INTEGRATION_TESTS repository variable until S002 provides KUBEBUILDER_ASSETS setup. Bump golangci-lint from v2.10 to v2.10.1. Update ci-workflow docs to align terminology and reflect the new gating condition. AI-assisted: Claude Code On-behalf-of: @SAP christian.berendt@sap.com Signed-off-by: Christian Berendt <berendt@23technologies.cloud>
AI-assisted: Claude Code On-behalf-of: @SAP christian.berendt@sap.com Signed-off-by: Christian Berendt <berendt@23technologies.cloud>
test, and test-integration running on push to main and PRs
security (checkout, setup-go, golangci-lint-action)
Go workspace root without a separate setup-go step
with default module caching enabled
concurrency group with cancel-in-progress to save CI resources
-tags=integration across all workspace modules
integration tests are introduced (CC-0002/S002)
triggers, jobs, Go setup convention, and dependencies