Skip to content

ci(go): utilize go.mod for go version #1131

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

franzramadhan
Copy link
Contributor

@franzramadhan franzramadhan commented Mar 27, 2025

Overview

What I've done

What I haven't done

How I tested

Screenshot

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • Chores
    • Updated build, deployment, and testing pipelines to dynamically derive the runtime version from project configuration.
    • Removed static version references and introduced checks to automatically use the latest stable version.
    • Enhancements improve consistency and reliability across backend services.

@franzramadhan franzramadhan requested a review from a team as a code owner March 27, 2025 08:58
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Walkthrough

The changes update multiple GitHub Actions workflow files to dynamically determine the Go version from a module file instead of relying on hardcoded values or environment variables. Each workflow now uses a go-version-file parameter (pointing to either server/api/go.mod or server/subscriber/go.mod) along with a new check-latest: true option to ensure the most recent Go version is used.

Changes

Files & Paths Change Summary
.github/workflows/build_deploy_api.yml
.github/workflows/ci_api.yml
Removed hardcoded go-version and the GO_VERSION environment variable; introduced go-version-file: 'server/api/go.mod' and check-latest: true to dynamically set the Go version.
.github/workflows/build_deploy_policies_cerbos.yml
.github/workflows/ci_policies.yml
Removed GO_VERSION environment variable; replaced go-version with go-version-file: 'server/api/go.mod' and added check-latest: true for dynamic version determination.
.github/workflows/build_deploy_subscriber.yml
.github/workflows/ci_subscriber.yml
Updated Go setup to use go-version-file: 'server/subscriber/go.mod' in place of hardcoded versions and introduced check-latest: true to ensure the latest version is applied.

Sequence Diagram(s)

sequenceDiagram
    participant W as Workflow
    participant M as go.mod File
    participant S as Setup-Go Action

    W->>M: Retrieve Go version information
    M-->>W: Return version detail
    W->>S: Provide configuration (go-version-file & check-latest)
    S-->>W: Configure and initialize Go environment
Loading

Possibly related PRs

Suggested labels

cicd, api

Poem

Hopping through the workflow maze with glee,
I’ve found a fresh path for Go to be free.
The go.mod file whispers the version’s rhyme,
With "check-latest" syncing in perfect time.
A joyful rabbit codes with a bounce and cheer,
Celebrating new changes that now appear! 🐇


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc288b9 and beca5ca.

📒 Files selected for processing (6)
  • .github/workflows/build_deploy_api.yml (1 hunks)
  • .github/workflows/build_deploy_policies_cerbos.yml (1 hunks)
  • .github/workflows/build_deploy_subscriber.yml (1 hunks)
  • .github/workflows/ci_api.yml (2 hunks)
  • .github/workflows/ci_policies.yml (1 hunks)
  • .github/workflows/ci_subscriber.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-api / ci-api-test
🔇 Additional comments (8)
.github/workflows/build_deploy_subscriber.yml (1)

35-36: Dynamic Go Version Setup is Implemented Correctly
The update to use go-version-file: 'server/subscriber/go.mod' along with check-latest: true improves maintainability by dynamically aligning the Go version with the repository’s module file. Please ensure that the referenced file exists and is kept up to date.

.github/workflows/ci_subscriber.yml (2)

15-16: Consistent Go Version Setup in Lint Job
Switching to go-version-file: 'server/subscriber/go.mod' with check-latest: true ensures that the lint job uses the Go version declared in the module file. This update enhances consistency and reduces maintenance overhead.


33-34: Consistent Go Version Setup in Test Job
The test job also now utilizes go-version-file: 'server/subscriber/go.mod' with check-latest: true, which helps maintain uniformity across the CI pipeline.

.github/workflows/build_deploy_api.yml (1)

35-36: Dynamic Go Version Setup for API Build
Replacing the hardcoded Go version with go-version-file: 'server/api/go.mod' and enabling check-latest: true effectively synchronizes the build environment with the Go module file. This is a positive change for long-term maintainability.

.github/workflows/ci_api.yml (2)

17-18: Dynamic Go Version Setup in Lint Stage
The modification to use go-version-file: 'server/api/go.mod' with check-latest: true in the lint stage ensures that the linter runs against the correct and up-to-date Go version.


65-66: Dynamic Go Version Setup in Test Stage
Similarly, the test stage now leverages the module file (server/api/go.mod) to determine the Go version, which improves consistency across the CI workflow.

.github/workflows/ci_policies.yml (1)

15-16: Dynamic Go Version Setup for Policies Check
Using go-version-file: 'server/api/go.mod' in combination with check-latest: true aligns this workflow’s Go environment with the module file. This change is consistent with the other workflows and reduces hardcoding of version values.

.github/workflows/build_deploy_policies_cerbos.yml (1)

21-22: Dynamic Go Version Configuration Update

The update replacing the hardcoded go-version with go-version-file: 'server/api/go.mod' along with the new check-latest: true parameter is a clear step toward a more flexible CI configuration. This change will force the workflow to derive the Go version from your module file and automatically update to the latest patch when available.

Consider verifying that the specified server/api/go.mod path is correct relative to the repository root and that all related workflows remain consistent with this approach.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Mar 27, 2025

Deploy Preview for reearth-flow canceled.

Name Link
🔨 Latest commit beca5ca
🔍 Latest deploy log https://app.netlify.com/sites/reearth-flow/deploys/67e51341f712c800085ebeb6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant