-
Notifications
You must be signed in to change notification settings - Fork 20
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
refactor: dynamic version and refactor builds #46
Conversation
WalkthroughThis update enhances the GoReleaser workflow for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Makefile
participant Dockerfile
participant GoReleaser
User->>Makefile: Invoke build
Makefile->>Dockerfile: Trigger build process
Dockerfile->>GoReleaser: Build application
GoReleaser-->>Dockerfile: Return built binary
Dockerfile-->>User: Provide pricefeeder binary
Poem
TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
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
Outside diff range, codebase verification and nitpick comments (1)
Makefile (1)
1-6
: Potential Issue: Missing Git TagsThe
git describe --tags --abbrev=0
command failed because no tags were found in the repository. This will cause theVERSION
variable to be empty, which may impact the build process if it relies on this version number.
- Ensure that tags are created in the repository to provide a valid version number.
#!/bin/bash # Verify if there are any tags in the repository. git tagAnalysis chain
LGTM! Verify the correctness of the shell commands.
The new variables are well-defined and enhance the build process. Ensure that the shell commands return the expected values.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the shell commands used in the Makefile. # Test: Check the output of the shell commands. Expect: Proper version and commit hash. echo "VERSION: $(git describe --tags --abbrev=0)" echo "COMMIT: $(git rev-parse HEAD)"Length of output: 240
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- .github/workflows/goreleaser.yml (1 hunks)
- .gitignore (1 hunks)
- .goreleaser.yml (1 hunks)
- Dockerfile (1 hunks)
- Makefile (2 hunks)
- cmd/version.go (1 hunks)
Files skipped from review due to trivial changes (1)
- .gitignore
Additional comments not posted (19)
Dockerfile (3)
3-3
: LGTM!The addition of build tools and Git is necessary for the new build process or dependencies.
12-12
: LGTM!Switching to
make build
suggests a more structured build process defined in a Makefile, which is beneficial for maintainability and flexibility.
17-19
: LGTM!Renaming the output binary to
pricefeeder
aligns with the application's context and enhances clarity.cmd/version.go (3)
13-16
: LGTM!The introduction of global variables
Version
andCommitHash
enhances the flexibility and maintainability of the version reporting feature.
20-21
: LGTM!The updated descriptions align the command's purpose with the updated context of the application.
23-23
: LGTM!The modification improves the informativeness and maintainability of the version reporting feature.
.github/workflows/goreleaser.yml (6)
8-9
: LGTM!The addition of the
permissions
section enhances the workflow's capability to manage repository contents.
15-16
: LGTM!Updating to the latest version of the action ensures compatibility and access to the latest features and fixes.
20-20
: LGTM!Updating to the latest version of the action ensures compatibility and access to the latest features and fixes.
22-22
: LGTM!Adding this step with updated parameters for the Go version and command arguments enhances the functionality and maintainability of the workflow.
24-24
: LGTM!Specifying a version constraint ensures that the workflow uses a compatible version of GoReleaser.
25-25
: LGTM!Using a more explicit invocation of GoReleaser with the
--clean
argument ensures a fresh build and enhances clarity.Makefile (1)
29-31
: LGTM!The
.PHONY
target and the$(BUILD_TARGETS)
rule streamline the build process and ensure version and commit hash information is embedded into the binary..goreleaser.yml (6)
1-1
: LGTM!The version update from
1
to2
indicates a shift in functionality or structure, aligning with the overall improvements.
5-5
: LGTM!Setting
CGO_ENABLED
to0
simplifies the build process by eliminating the need for CGO bindings.
17-19
: LGTM!The architecture-specific environment variables enhance clarity and specificity in the build process.
24-26
: LGTM!The updated
ldflags
section ensures that version and commit hash information is embedded into the binary, improving traceability and debugging.
37-39
: LGTM!The architecture-specific environment variables enhance clarity and specificity in the build process.
44-46
: LGTM!The updated
ldflags
section ensures that version and commit hash information is embedded into the binary, improving traceability and debugging.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- config/config_test.go (2 hunks)
Additional comments not posted (3)
config/config_test.go (3)
11-13
: LGTM! Initialization function enhances consistency.The
init
function ensures that application prefixes are set up before any tests are executed, enhancing the consistency of the test environment.
Line range hint
15-28
:
LGTM! Environment setup and config retrieval are correct.The
TestConfig_Get
function correctly sets environment variables and tests the configuration retrieval.
30-36
: LGTM! Proper testing withoutEXCHANGE_SYMBOLS_MAP
.The
TestConfig_Without_EXCHANGE_SYMBOLS_MAP
function correctly tests configuration retrieval without theEXCHANGE_SYMBOLS_MAP
environment variable. The removal of thefmt.Println
statement is appropriate.
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
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- config/config.go (2 hunks)
Additional comments not posted (3)
config/config.go (3)
18-18
: LGTM!The addition of the
defaultGrpcEndpoint
constant enhances configuration flexibility and robustness.
19-19
: LGTM!The addition of the
defaultWebsocketEndpoint
constant enhances configuration flexibility and robustness.
95-100
: LGTM!The updates to the
Get
function ensure that the application has a fallback mechanism for connecting to necessary services, thereby improving robustness and user experience.
This PR makes a few changes:
version
command.version
command, and dynamically sets them at build time.Summary by CodeRabbit
New Features
Chores
.gitignore
file to maintain a clean repository.Refactor