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

feat: Remove earthly usage #640

Merged
merged 2 commits into from
Jan 6, 2025
Merged

feat: Remove earthly usage #640

merged 2 commits into from
Jan 6, 2025

Conversation

flemzord
Copy link
Member

@flemzord flemzord commented Jan 6, 2025

No description provided.

@flemzord flemzord requested a review from a team as a code owner January 6, 2025 19:42
Copy link

coderabbitai bot commented Jan 6, 2025

Walkthrough

This pull request introduces significant changes to the build and deployment infrastructure, focusing on restructuring OpenAPI and client generation processes. The modifications span across multiple configuration files including Earthfile, Justfile, and flake.nix. The changes primarily involve removing OpenAPI-related build steps, updating deployment configurations, and integrating the Speakeasy tool for SDK generation. The overall approach seems to streamline the build process and simplify the project's toolchain.

Changes

File Change Summary
Earthfile Removed OpenAPI processing steps (pre-commit, openapi, openapi-markdown, generate-client)
Earthfile Updated deploy section to copy files from sources directory to /src
Earthfile Modified build-image to pass compiled main binary to ledger entry point
Justfile Added new targets openapi and generate-client
Justfile Updated pre-commit target to include openapi and generate-client
Justfile Removed earthly target
flake.nix Added nur input
flake.nix Introduced speakeasy package derivation
pkg/client/formance.go Updated SDK and OpenAPI document versions

Possibly related PRs

Suggested labels

build-images

Suggested reviewers

  • gfyrag

Poem

🐰 Hop, hop, build and deploy,
Earthly configs, a developer's joy!
OpenAPI steps, now swept away,
Speakeasy dances, leading the way!
A streamlined path, clean and bright,
Code deployment taking flight! 🚀


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>, 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

CodeRabbit Configuration 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.

…thfile`

- Added `openapi` task to `Justfile` for merging specs and generating docs.
- Removed OpenAPI-related tasks from `Earthfile` in favor of `Justfile`.
- Streamlined pre-commit process by centralizing OpenAPI steps in `Justfile`.

This simplifies the OpenAPI generation workflow and reduces duplication,
making the development process more efficient and maintainable.
- Add speakeasy CLI as an installable package in the Nix Flake.
- Support multiple platforms with pre-defined hashes and binaries.
- Enhance Nix devShells by including speakeasy for supported systems.
- Simplify Justfile tasks by removing redundant Earthly build steps.
- Update speakeasy generate command in Justfile for better usability.
- Refactor workflows to eliminate unnecessary steps in Earthfile.

These changes streamline SDK generation, improve multi-platform support,
and reduce reliance on Earthly for local builds.
@flemzord flemzord force-pushed the feat/remove-earthly-usage branch from b31126a to 5fa3086 Compare January 6, 2025 19:44
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

🧹 Nitpick comments (3)
Justfile (2)

33-35: Add error handling for OpenAPI file merging.

The openapi target assumes all YAML files exist. Consider adding checks to ensure files exist before merging.

 openapi:
+  @test -f openapi/v1.yaml || (echo "openapi/v1.yaml not found" && exit 1)
+  @test -f openapi/v2.yaml || (echo "openapi/v2.yaml not found" && exit 1)
+  @test -f openapi/overlay.yaml || (echo "openapi/overlay.yaml not found" && exit 1)
   @yq eval-all '. as $item ireduce ({}; . * $item)' openapi/v1.yaml openapi/v2.yaml openapi/overlay.yaml > openapi.yaml
   @npx -y widdershins {{justfile_directory()}}/openapi/v2.yaml -o {{justfile_directory()}}/docs/api/README.md --search false --language_tabs 'http:HTTP' --summary --omitHeader

37-38: Add validation for OpenAPI file existence.

The generate-client target should verify that openapi.yaml exists before attempting SDK generation.

 generate-client:
+  @test -f openapi.yaml || (echo "openapi.yaml not found. Run 'just openapi' first." && exit 1)
   @speakeasy generate sdk -s openapi.yaml -o ./pkg/client -l go
flake.nix (1)

58-78: Consider adding binary verification.

The package derivation looks good, but consider adding SHA256 verification of the binary itself for additional security.

 installPhase = ''
   mkdir -p $out/bin
   unzip $src
   ls -al
+  echo "${speakeasyHashes.${system}}" | sha256sum -c
   install -m755 speakeasy $out/bin/
 '';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 701a0ab and 5fa3086.

⛔ Files ignored due to path filters (5)
  • openapi.yaml is excluded by !**/*.yaml
  • openapi/openapi-merge.json is excluded by !**/*.json
  • openapi/overlay.yaml is excluded by !**/*.yaml
  • pkg/client/.speakeasy/gen.lock is excluded by !**/*.lock, !**/*.lock
  • pkg/client/.speakeasy/gen.yaml is excluded by !**/*.yaml
📒 Files selected for processing (6)
  • Earthfile (0 hunks)
  • Justfile (2 hunks)
  • flake.nix (2 hunks)
  • pkg/client/docs/models/operations/runscriptresponse.md (1 hunks)
  • pkg/client/formance.go (1 hunks)
  • pkg/client/models/operations/runscript.go (1 hunks)
💤 Files with no reviewable changes (1)
  • Earthfile
✅ Files skipped from review due to trivial changes (2)
  • pkg/client/docs/models/operations/runscriptresponse.md
  • pkg/client/models/operations/runscript.go
🔇 Additional comments (4)
Justfile (1)

6-6: LGTM! Pre-commit workflow updated.

The pre-commit target now includes the new OpenAPI and client generation tasks, properly replacing the removed earthly functionality.

flake.nix (2)

36-48: LGTM! Well-structured speakeasy configuration.

The version, platform mappings, and hashes are well-organized and comprehensive.


87-107: LGTM! Development shell properly configured.

The development shell includes all necessary tools, including the newly added speakeasy package.

pkg/client/formance.go (1)

145-148: Verify API compatibility with version upgrade.

The OpenAPI version has been upgraded from v1 to v2, and the SDK version has been bumped to 0.6.0. Please ensure:

  1. All API consumers are aware of the version change
  2. Breaking changes are documented
  3. Migration guide is available if needed

Run this script to check for potential breaking changes:

✅ Verification successful

API version upgrade appears backward compatible

The v2 upgrade maintains backward compatibility:

  • v1 endpoints are preserved and still operational
  • Path changes are minor and non-breaking (e.g., /_info/_/info)
  • Both versions coexist in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Compare OpenAPI specs to identify breaking changes

# Check if both versions exist
if [ -f "openapi/v1.yaml" ] && [ -f "openapi/v2.yaml" ]; then
  # Compare endpoints and their parameters
  echo "Comparing API endpoints and parameters:"
  rg -A 5 "paths:" openapi/v1.yaml
  echo "---"
  rg -A 5 "paths:" openapi/v2.yaml
fi

# Search for API version references in codebase
echo "Searching for API version references:"
rg "v1" --type go

Length of output: 11088

@flemzord flemzord added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 8fe29fd Jan 6, 2025
8 checks passed
@flemzord flemzord deleted the feat/remove-earthly-usage branch January 6, 2025 20:59
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.65%. Comparing base (701a0ab) to head (5fa3086).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
- Coverage   81.69%   81.65%   -0.05%     
==========================================
  Files         131      131              
  Lines        7070     7070              
==========================================
- Hits         5776     5773       -3     
- Misses        991      993       +2     
- Partials      303      304       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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