diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml index 91aeb565..7f55a4fc 100644 --- a/cli/.goreleaser.yaml +++ b/cli/.goreleaser.yaml @@ -8,9 +8,32 @@ before: - go generate ./... - go build builds: - - binary: "dive" + - id: cli + binary: "dive" env: - - CGO_ENABLED=0 + - CGO_ENABLED={{ if eq .Os "windows" }}0{{ else }}1{{ end }} + # Only override compilers if we are on CI, otherwise use the locally available C/C++ toolchain + - >- + {{- if index .Env "CI" }} + {{- if eq .Os "darwin" }}CC=o64h-clang{{- end }} + {{- if eq .Os "linux" }} + {{- if eq .Arch "amd64"}}CC=x86_64-linux-musl-gcc{{- end }} + {{- if eq .Arch "arm64"}}CC=aarch64-linux-musl-gcc{{- end }} + {{- end }} + {{- end }} + - >- + {{- if index .Env "CI" }} + {{- if eq .Os "darwin" }}CXX=o64h-clang++{{- end }} + {{- if eq .Os "linux" }} + {{- if eq .Arch "amd64"}}CXX=x86_64-linux-musl-g++{{- end }} + {{- if eq .Arch "arm64"}}CXX=aarch64-linux-musl-g++{{- end }} + {{- end }} + {{- end }} + ldflags: + - >- + {{- if eq .Os "linux" }}-linkmode external -extldflags "-static"{{- end }} + tags: + - osusergo goos: - linux - windows @@ -20,23 +43,15 @@ builds: - arm64 archives: - - format: tar.gz - # this name template makes the OS and Arch compatible with the results of uname. - name_template: >- - {{ tolower .ProjectName }}_ - {{- tolower .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip - + - id: cli + builds: + - cli + name_template: dive-cli_{{ .Tag }}_{{ tolower .Os }}_{{ .Arch }} brews: # creates a brew formula representing the latest version - name: dive-cli + ids: + - cli tap: owner: hugobyte name: homebrew-tap @@ -54,14 +69,16 @@ brews: # creates a versioned brew formula, enabling installation of specific versions of kurtosis cli - name: dive-cli@{{ .Tag }} + ids: + - cli tap: owner: hugobyte name: homebrew-tap commit_author: name: shreyasbhat0 commit_msg_template: "Automated formula created for the CLI, version {{ .Tag }}" - homepage: "https://www.kurtosistech.com" - description: "CLI for managing Kurtosis environments." + homepage: "https://hugobyte.com" + description: "CLI for Dive Package" license: "Apache 2.0" # NOTE: Goreleaser *should* automatically detect the binaries packaged inside the archives being installed by the Homebrew formula, but it doesn't due to: # https://github.com/goreleaser/goreleaser/issues/2488 diff --git a/cli/commands/chain/types/eth.go b/cli/commands/chain/types/eth.go index 048c04f2..3f451b4f 100644 --- a/cli/commands/chain/types/eth.go +++ b/cli/commands/chain/types/eth.go @@ -23,7 +23,7 @@ It establishes a connection to the Ethereum network and allows the node in execu data := RunEthNode(diveContext) diveContext.SetSpinnerMessage("Execution Completed") - err := data.WriteDiveResponse(diveContext) + err := data.WriteDiveResponse() if err != nil { diveContext.FatalError("Failed To Write To File", err.Error()) } diff --git a/cli/commands/chain/types/hardhat.go b/cli/commands/chain/types/hardhat.go index 1c70c1df..87de6be1 100644 --- a/cli/commands/chain/types/hardhat.go +++ b/cli/commands/chain/types/hardhat.go @@ -21,7 +21,7 @@ It establishes a connection to the hardhat network and allows the node in execut diveContext.SetSpinnerMessage("Execution Completed") - err := data.WriteDiveResponse(diveContext) + err := data.WriteDiveResponse() if err != nil { diveContext.FatalError("Failed To Write To File", err.Error()) } diff --git a/cli/commands/chain/types/icon.go b/cli/commands/chain/types/icon.go index 790bf653..22823832 100644 --- a/cli/commands/chain/types/icon.go +++ b/cli/commands/chain/types/icon.go @@ -75,7 +75,7 @@ It establishes a connection to the Icon network and allows the node in executing diveContext.SetSpinnerMessage("Starting Decentralisation") Decentralisation(diveContext, params) - err := nodeResponse.WriteDiveResponse(diveContext) + err := nodeResponse.WriteDiveResponse() if err != nil { diveContext.FatalError("Failed To Write To File", err.Error()) @@ -87,7 +87,7 @@ It establishes a connection to the Icon network and allows the node in executing nodeResponse := RunIconNode(diveContext) - err := nodeResponse.WriteDiveResponse(diveContext) + err := nodeResponse.WriteDiveResponse() if err != nil { diveContext.FatalError("Failed To Write To File", err.Error()) @@ -99,7 +99,6 @@ It establishes a connection to the Icon network and allows the node in executing }, } - iconCmd.Flags().StringVarP(&id, "id", "i", "", "custom chain id for icon node") iconCmd.Flags().StringVarP(&genesis, "genesis", "g", "", "path to custom genesis file") iconCmd.Flags().StringVarP(&configFilePath, "config", "c", "", "path to custom config json file") iconCmd.Flags().BoolP("decentralisation", "d", false, "decentralise Icon Node") @@ -120,7 +119,7 @@ func IconDecentralisationCmd(diveContext *common.DiveContext) *cobra.Command { Run: func(cmd *cobra.Command, args []string) { params := GetDecentralizeParms(serviceName, nodeEndpoint, keystorePath, keystorepassword, networkID) - + diveContext.InitKurtosisContext() Decentralisation(diveContext, params) diveContext.StopSpinner(fmt.Sprintln("Decentralisation Completed.Please find service details in dive.json")) diff --git a/cli/common/types.go b/cli/common/types.go index 182f4a9d..78a3aa39 100644 --- a/cli/common/types.go +++ b/cli/common/types.go @@ -38,6 +38,7 @@ func (dive *DiveserviceResponse) Decode(responseData []byte) (*DiveserviceRespon return dive, nil } func (dive *DiveserviceResponse) EncodeToString() (string, error) { + encodedBytes, err := json.Marshal(dive) if err != nil { return "", nil @@ -45,7 +46,7 @@ func (dive *DiveserviceResponse) EncodeToString() (string, error) { return string(encodedBytes), nil } -func (dive *DiveserviceResponse) WriteDiveResponse(diveContext *DiveContext) error { +func (dive *DiveserviceResponse) WriteDiveResponse() error { serialisedData, err := dive.EncodeToString() @@ -105,7 +106,6 @@ func ReadConfigFile(filePath string) ([]byte, error) { return file, nil } func WriteToFile(data string) error { - pwd, err := os.Getwd() if err != nil {