Skip to content

Commit

Permalink
Release 0.0.2
Browse files Browse the repository at this point in the history
Embed build version in library, fix korrel8 dependency.
  • Loading branch information
alanconway committed Jun 1, 2024
1 parent f405130 commit 096a17a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
36 changes: 21 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@

all: generate lint test
all: build lint test

VERSION=0.0.1

include .bingo/Variables.mk
VERSION=0.0.2

KORREL8RCLI=cmd/korrel8rcli/korrel8rcli
VERSION_TXT=pkg/build/version.txt
SWAGGER_CLIENT=pkg/swagger
SWAGGER_SPEC=korrel8r-swagger.json
GOCOVERDIR=cmd/korrel8rcli/covdata

clean:
rm -rf $(GOCOVERDIR) $(KORREL8RCLI) $(SWAGGER_CLIENT) $(SWAGGER_SPEC)

generate: $(SWAGGER_CLIENT)
include .bingo/Variables.mk

build: $(KORREL8RCLI)

$(KORREL8RCLI): $(shell find -name *.go) generate
@mkdir -p $(dir $@)
go build -cover -o $@ ./cmd/korrel8rcli

lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run ./...

test: $(KORREL8RCLI) $(KORREL8R) $(TEST_ENV)
test: $(KORREL8RCLI) $(KORREL8R)
KORREL8R=$(KORREL8R) go test -cover -race ./...
@echo -e "\\nAccumulated coverage from main_test"
go tool covdata percent -i $(GOCOVERDIR)

release: all
hack/tag-release.sh $(VERSION)
clean:
rm -rf $(GOCOVERDIR) $(KORREL8RCLI) $(SWAGGER_CLIENT) $(SWAGGER_SPEC)

ifneq ($(VERSION),$(file <$(VERSION_TXT)))
.PHONY: $(VERSION_TXT) # Force update if VERSION_TXT does not match $(VERSION)
endif
$(VERSION_TXT):
echo $(VERSION) > $@

$(KORREL8RCLI): $(VERSION_TXT) $(SWAGGER_CLIENT) $(shell find -name *.go)
@mkdir -p $(dir $@)
@go mod tidy
go build -cover -o $@ ./cmd/korrel8rcli

$(SWAGGER_SPEC): $(KORREL8R)
$(KORREL8R) web --spec $@
Expand All @@ -39,3 +42,6 @@ $(SWAGGER_CLIENT): $(SWAGGER_SPEC) $(SWAGGER) ## Generate client packages.
@mkdir -p $@
cd $@ && $(SWAGGER) generate -q client -f $(abspath $(SWAGGER_SPEC)) && go mod tidy
touch $@

release: all
hack/tag-release.sh $(VERSION)
6 changes: 4 additions & 2 deletions cmd/korrel8rcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import (
"os"

httptransport "github.com/go-openapi/runtime/client"
"github.com/korrel8r/client/pkg/build"
"github.com/korrel8r/client/pkg/swagger/client"
"github.com/spf13/cobra"
)

var (
rootCmd = &cobra.Command{
Use: "korrel8rcli COMMAND",
Short: "REST client for a remote korrel8r server.",
Use: "korrel8rcli COMMAND",
Short: "REST client for a remote korrel8r server.",
Version: build.Version,
}

// Global Flags
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/korrel8r/korrel8r v0.6.5 h1:PVxgYoplwDcxwqx4EaQVly9JK1uq7uBrHokq5+uEoyU=
github.com/korrel8r/korrel8r v0.6.5/go.mod h1:2hx8gEgyDXSbDYqxlqOUxlFnxfxZ2IYk5Ts1fL8Ye28=
github.com/korrel8r/korrel8r v0.6.5 h1:1n+lI8cPN5YX1Vyn0wl+ujpIdl5wOOtgN2PLUSL/uzo=
github.com/korrel8r/korrel8r v0.6.5/go.mod h1:ttC8wLIyHtU1yjDiIpHEjt/BWllSk09ZUk7KLGgyzLU=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down
9 changes: 9 additions & 0 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package build

import "strings"

var (
version string //+embed:version.txt
// Version of the current build, a semver string.
Version = strings.TrimSpace(version)
)
1 change: 1 addition & 0 deletions pkg/build/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.2

0 comments on commit 096a17a

Please sign in to comment.