Skip to content
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

Implement CI/CD workflows for Initia binary builds #227

Closed
wants to merge 75 commits into from

Conversation

LizJeong
Copy link
Contributor

Implement CI/CD workflows for Initia binary builds

  • Add build-and-upload.yml: Main workflow coordinating build processes
    • Set up matrix strategy for multiple platforms (Linux, Darwin)
    • Trigger builds for amd64 and arm64 architectures
  • Add build-darwin.yml: Darwin-specific build workflow
    • Configure macOS environment and build process
    • Support amd64 and arm64 architectures
  • Add build-linux.yml: Linux-specific build workflow
    • Set up Ubuntu environment and build process
    • Include steps for amd64 and arm64 builds
  • Implement automatic uploads to Google Cloud Storage for all builds
  • Add verification steps and public URL generation for uploaded binaries

Motivation and Context

This patch significantly improves the Initia developer experience by automating the build and distribution process for multiple platforms and architectures. It reduces manual effort, ensures consistency in builds, and makes it easier to distribute binaries to users.

How Has This Been Tested?

The workflows have been tested locally on both Linux and macOS environments. However, full end-to-end testing requires the setup of Google Cloud Storage secrets in the GitHub repository.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Additional Notes

To fully utilize these workflows, the following secrets need to be added to the repository:

  1. GCP_SA_KEY: The service account key for Google Cloud authentication
  2. GCS_BUCKET: The name of the Google Cloud Storage bucket for uploads

@repository-owner Please add these secrets to the repository settings before merging this PR.

- Add build-and-upload.yml: Main workflow coordinating build processes
  * Set up matrix strategy for multiple platforms (Linux, Darwin)
  * Trigger builds for amd64 and arm64 architectures

- Add build-darwin.yml: Darwin-specific build workflow
  * Configure macOS environment and build process
  * Support amd64 and arm64 architectures

- Add build-linux.yml: Linux-specific build workflow
  * Set up Ubuntu environment and build process
  * Include steps for amd64 and arm64 builds

- Implement automatic uploads to Google Cloud Storage for all builds
- Add verification steps and public URL generation for uploaded binaries
@LizJeong LizJeong requested a review from a team as a code owner July 12, 2024 07:44
Copy link

coderabbitai bot commented Jul 12, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The changes introduce new GitHub Actions workflows to automate building and uploading a project to Google Cloud Storage (GCS) for both Linux and macOS. These workflows are triggered on tag pushes starting with 'v*' and support different architectures. Each workflow includes steps for building the project, archiving the artifacts, and uploading them to GCS with necessary authentication.

Changes

File Path Change Summary
.github/workflows/build-and-upload.yml Added a workflow that triggers on tag pushes, builds for various architectures and OS, and uploads to GCS.
.github/workflows/build-darwin.yml Introduced a workflow to build a project for macOS, archive the artifacts, and upload to GCS.
.github/workflows/build-linux.yml Created a workflow to compile and package a project for Linux, and generate a public URL for the uploaded files.

Poem

In the realms of code, we now see,
Workflows crafted with harmony.
For Linux and Darwin, they build and glide,
To GCS, our artifacts ride.
Tag and push, then let it flow,
Automated magic, in one swift go. 🚀🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9ec5220 and a1c9de1.

Files selected for processing (3)
  • .github/workflows/build-and-upload.yml (1 hunks)
  • .github/workflows/build-darwin.yml (1 hunks)
  • .github/workflows/build-linux.yml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/build-and-upload.yml
Additional comments not posted (14)
.github/workflows/build-linux.yml (7)

3-9: LGTM! Workflow trigger and inputs are correctly defined.

The workflow is triggered by a workflow call and requires an input for the architecture.


10-12: LGTM! Job definition and runner specification are appropriate.

The job runs on the ubuntu-latest runner.


14-15: LGTM! Code checkout step is correctly defined.

The step uses the actions/checkout@v3 action.


17-20: LGTM! Go setup step is correctly defined.

The step uses the actions/setup-go@v4 action and specifies Go version 1.22.4.


22-31: LGTM! Build and packaging steps are correctly defined.

The step runs a series of commands to build the project, create directories, and package the build artifacts. The use of make ensures that the build process is consistent with the project's build system.


32-39: LGTM! Google Cloud authentication and SDK setup steps are correctly defined.

The steps use the google-github-actions/auth@v2 and google-github-actions/setup-gcloud@v2 actions.


40-56: LGTM! Upload and verification steps are correctly defined.

The steps use gsutil to upload the build artifacts to GCS and verify the upload.

.github/workflows/build-darwin.yml (7)

3-9: LGTM! Workflow trigger and inputs are correctly defined.

The workflow is triggered by a workflow call and requires an input for the architecture.


10-12: LGTM! Job definition and runner specification are appropriate.

The job runs on the macos-latest runner.


14-15: LGTM! Code checkout step is correctly defined.

The step uses the actions/checkout@v3 action.


17-20: LGTM! Go setup step is correctly defined.

The step uses the actions/setup-go@v4 action and specifies Go version 1.22.4.


22-31: LGTM! Build and packaging steps are correctly defined.

The step runs a series of commands to build the project, create directories, and package the build artifacts. The use of make ensures that the build process is consistent with the project's build system.


32-39: LGTM! Google Cloud authentication and SDK setup steps are correctly defined.

The steps use the google-github-actions/auth@v2 and google-github-actions/setup-gcloud@v2 actions.


40-56: LGTM! Upload and verification steps are correctly defined.

The steps use gsutil to upload the build artifacts to GCS and verify the upload.

Copy link
Member

@etienne-napoleone etienne-napoleone left a comment

Choose a reason for hiding this comment

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

Looking good, I like the reusable workflow calls 👍

Just one thing, wouldn't it simpler and more user friendly to uploads the build artifacts directly to the github release instead of a GCS bucket? (Might need to change the trigger to new release instead of tag push)

I feel like this is where people expect to find build artifacts when looking at a project.

@LizJeong LizJeong marked this pull request as draft July 12, 2024 08:02
@LizJeong LizJeong closed this Jul 15, 2024
@LizJeong
Copy link
Contributor Author

There is a bug in the current commit. . I will fix the issue and submit a new PR

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

Successfully merging this pull request may close these issues.

2 participants