From c22b3ce1fb65b3add266055c6636d16e214e44d7 Mon Sep 17 00:00:00 2001 From: jason-fugue <59576760+jason-fugue@users.noreply.github.com> Date: Mon, 23 Mar 2020 14:34:00 -0400 Subject: [PATCH] Release preparation (#5) * Update module name * Added versioning and release target --- .gitignore | 2 ++ Makefile | 19 +++++++++++++++++-- VERSION | 1 + cache/cache.go | 4 ++-- cache/cache_test.go | 4 ++-- cloud/cfn/provider.go | 4 ++-- cloudformation/cloudformation.go | 2 +- cmd/addToken.go | 2 +- cmd/helpers.go | 4 ++-- cmd/listComponents.go | 2 +- cmd/listEnv.go | 2 +- cmd/listInputs.go | 2 +- cmd/listOutputs.go | 2 +- cmd/listRules.go | 2 +- cmd/root.go | 6 ++++-- cmd/run.go | 8 ++++---- cmd/showKey.go | 4 ++-- cmd/version.go | 8 ++++++++ cmp/main.go | 2 +- git/git.go | 4 ++-- git/git_test.go | 2 +- go.mod | 2 +- main.go | 2 +- project/component.go | 2 +- project/component_test.go | 2 +- project/discover.go | 2 +- project/fargate.go | 2 +- project/graph.go | 2 +- project/middleware.go | 2 +- project/project.go | 2 +- project/project_test.go | 2 +- project/rule.go | 2 +- project/runner_test.go | 2 +- project/term.go | 2 +- sched/interface.go | 2 +- sched/sched.go | 4 ++-- sched/sched_test.go | 4 ++-- sched/worker.go | 2 +- sched/worker_test.go | 4 ++-- signer/main.go | 2 +- slave/slave.go | 8 ++++---- store/http.go | 2 +- 42 files changed, 84 insertions(+), 56 deletions(-) create mode 100644 VERSION create mode 100644 cmd/version.go diff --git a/.gitignore b/.gitignore index 601d7b5..4002545 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ zim +zim-* .mypy_cache/ .vscode local-config.mk @@ -6,3 +7,4 @@ cfn_deploy.yaml signer.zip auth.zip samconfig.toml +venv diff --git a/Makefile b/Makefile index 239a6b8..ec94d5c 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,13 @@ BINARY = zim INSTALLED_BINARY = /usr/local/bin/$(BINARY) SOURCE = $(wildcard *.go) $(wildcard */*.go) $(wildcard cloud/*/*.go) GO = GO111MODULE=on go +VERSION = $(shell cat VERSION) +GITCOMMIT = $(shell git rev-parse --short HEAD 2> /dev/null || true) +define LDFLAGS + -X \"github.com/fugue/zim/cmd.Version=$(VERSION)\" \ + -X \"github.com/fugue/zim/cmd.GitCommit=$(GITCOMMIT)\" +endef +CLI_BUILD = $(GO) build -ldflags="$(LDFLAGS)" # Variables relating to the Zim CloudFormation stack STACK_NAME ?= zim @@ -21,7 +28,15 @@ API_URL = $(shell aws cloudformation describe-stacks \ --output text) $(BINARY): $(SOURCE) - $(GO) build -v -o $(BINARY) + $(CLI_BUILD) -v -o $@ + +$(BINARY)-linux-amd64: $(SOURCE) + GOOS=linux GOARCH=amd64 $(CLI_BUILD) -o $@ + +$(BINARY)-darwin-amd64: $(SOURCE) + GOOS=darwin GOARCH=amd64 $(CLI_BUILD) -o $@ + +release: $(BINARY)-linux-amd64 $(BINARY)-darwin-amd64 .PHONY: install install: $(INSTALLED_BINARY) @@ -59,7 +74,7 @@ deploy: stack clean: rm -f cmp/cmp rm -f coverage.out - rm -f $(BINARY) + rm -f $(BINARY) $(BINARY)-linux-amd64 $(BINARY)-darwin-amd64 rm -f $(SIGNER_DIST) $(AUTH_DIST) .PHONY: test diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/cache/cache.go b/cache/cache.go index 2caa418..a5e7cf9 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -12,8 +12,8 @@ import ( "path/filepath" "sort" - "github.com/LuminalHQ/zim/project" - "github.com/LuminalHQ/zim/store" + "github.com/fugue/zim/project" + "github.com/fugue/zim/store" ) const WriteOnly = "WRITE_ONLY" diff --git a/cache/cache_test.go b/cache/cache_test.go index a61a9fb..aacd779 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -7,9 +7,9 @@ import ( "path" "testing" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/project" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/cloud/cfn/provider.go b/cloud/cfn/provider.go index 78be626..0fa63f6 100644 --- a/cloud/cfn/provider.go +++ b/cloud/cfn/provider.go @@ -10,8 +10,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" cf "github.com/aws/aws-sdk-go/service/cloudformation" - "github.com/LuminalHQ/zim/cache" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/cache" + "github.com/fugue/zim/project" ) // CloudFormationError is a simple error type diff --git a/cloudformation/cloudformation.go b/cloudformation/cloudformation.go index 31ec9be..ac827bb 100644 --- a/cloudformation/cloudformation.go +++ b/cloudformation/cloudformation.go @@ -6,7 +6,7 @@ import ( "github.com/awslabs/goformation" "github.com/awslabs/goformation/intrinsics" - "github.com/LuminalHQ/zim/graph" + "github.com/fugue/zim/graph" ) // DiscoverDependencies returns a Graph representing dependencies between diff --git a/cmd/addToken.go b/cmd/addToken.go index 6d8c107..b188958 100644 --- a/cmd/addToken.go +++ b/cmd/addToken.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/project" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" diff --git a/cmd/helpers.go b/cmd/helpers.go index 6b825a6..2185155 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -6,8 +6,8 @@ import ( "path" "path/filepath" - "github.com/LuminalHQ/zim/git" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/git" + "github.com/fugue/zim/project" "github.com/spf13/viper" ) diff --git a/cmd/listComponents.go b/cmd/listComponents.go index f6be48a..07de5bb 100644 --- a/cmd/listComponents.go +++ b/cmd/listComponents.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/LuminalHQ/zim/format" + "github.com/fugue/zim/format" "github.com/spf13/cobra" ) diff --git a/cmd/listEnv.go b/cmd/listEnv.go index f1c6339..e0b2741 100644 --- a/cmd/listEnv.go +++ b/cmd/listEnv.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/LuminalHQ/zim/format" + "github.com/fugue/zim/format" "github.com/fatih/structs" "github.com/spf13/cobra" ) diff --git a/cmd/listInputs.go b/cmd/listInputs.go index 569c654..f2d2971 100644 --- a/cmd/listInputs.go +++ b/cmd/listInputs.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/LuminalHQ/zim/format" + "github.com/fugue/zim/format" "github.com/spf13/cobra" ) diff --git a/cmd/listOutputs.go b/cmd/listOutputs.go index 61e4f89..be8fe21 100644 --- a/cmd/listOutputs.go +++ b/cmd/listOutputs.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/LuminalHQ/zim/format" + "github.com/fugue/zim/format" "github.com/fatih/color" "github.com/spf13/cobra" ) diff --git a/cmd/listRules.go b/cmd/listRules.go index 6763b60..25db689 100644 --- a/cmd/listRules.go +++ b/cmd/listRules.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/LuminalHQ/zim/format" + "github.com/fugue/zim/format" "github.com/spf13/cobra" ) diff --git a/cmd/root.go b/cmd/root.go index 09a6612..73a0fd6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,6 +1,7 @@ package cmd import ( + "fmt" "os" "github.com/spf13/cobra" @@ -9,8 +10,9 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "zim", - Short: "The caching build tool", + Use: "zim", + Short: "The caching build tool", + Version: fmt.Sprintf("%s, build %s", Version, GitCommit), } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/cmd/run.go b/cmd/run.go index c96ab13..fd7355a 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -8,10 +8,10 @@ import ( "path/filepath" "time" - "github.com/LuminalHQ/zim/cache" - "github.com/LuminalHQ/zim/project" - "github.com/LuminalHQ/zim/sched" - "github.com/LuminalHQ/zim/store" + "github.com/fugue/zim/cache" + "github.com/fugue/zim/project" + "github.com/fugue/zim/sched" + "github.com/fugue/zim/store" "github.com/fatih/color" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/cmd/showKey.go b/cmd/showKey.go index c9813b4..ec6da50 100644 --- a/cmd/showKey.go +++ b/cmd/showKey.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/LuminalHQ/zim/cache" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/cache" + "github.com/fugue/zim/project" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..e937ccd --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,8 @@ +package cmd + +// Default build-time variables. +// These values are overridden via ldflags +var ( + Version = "unknown-version" + GitCommit = "unknown-commit" +) diff --git a/cmp/main.go b/cmp/main.go index 70ca269..5ee28c6 100644 --- a/cmp/main.go +++ b/cmp/main.go @@ -11,7 +11,7 @@ import ( "sort" "strings" - "github.com/LuminalHQ/zim/zip" + "github.com/fugue/zim/zip" ) func tmpDir() string { diff --git a/git/git.go b/git/git.go index 033957e..d0be16c 100644 --- a/git/git.go +++ b/git/git.go @@ -11,8 +11,8 @@ import ( "path/filepath" "strings" - "github.com/LuminalHQ/zim/store" - "github.com/LuminalHQ/zim/zip" + "github.com/fugue/zim/store" + "github.com/fugue/zim/zip" ) // CreateArchive creates a Git archive at the given path diff --git a/git/git_test.go b/git/git_test.go index aeca690..eabe521 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - "github.com/LuminalHQ/zim/zip" + "github.com/fugue/zim/zip" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/go.mod b/go.mod index 0c272ef..0676143 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/LuminalHQ/zim +module github.com/fugue/zim go 1.12 diff --git a/main.go b/main.go index 76c68c7..7de7aac 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ package main //go:generate mockgen -source=project/runner.go -package project -destination project/runner_mock.go //go:generate mockgen -source=project/exec.go -package project -destination project/exec_mock.go -import "github.com/LuminalHQ/zim/cmd" +import "github.com/fugue/zim/cmd" func main() { cmd.Execute() diff --git a/project/component.go b/project/component.go index 324211f..5bdc789 100644 --- a/project/component.go +++ b/project/component.go @@ -6,7 +6,7 @@ import ( "path" "path/filepath" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" "github.com/hashicorp/go-multierror" ) diff --git a/project/component_test.go b/project/component_test.go index c3ec5d3..e16b2fd 100644 --- a/project/component_test.go +++ b/project/component_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" ) func TestNewComponentError(t *testing.T) { diff --git a/project/discover.go b/project/discover.go index 6eaeba4..2b21ff3 100644 --- a/project/discover.go +++ b/project/discover.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" ) var ignoreDirs map[string]bool diff --git a/project/fargate.go b/project/fargate.go index 07d6f45..5b011a3 100644 --- a/project/fargate.go +++ b/project/fargate.go @@ -7,7 +7,7 @@ import ( "time" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" - "github.com/LuminalHQ/zim/queue" + "github.com/fugue/zim/queue" ) // FargateRunner runs a rule on a remote container diff --git a/project/graph.go b/project/graph.go index 04187e6..c92497c 100644 --- a/project/graph.go +++ b/project/graph.go @@ -1,7 +1,7 @@ package project import ( - "github.com/LuminalHQ/zim/graph" + "github.com/fugue/zim/graph" ) // GraphFromRules builds a dependency graph originating from the specified diff --git a/project/middleware.go b/project/middleware.go index 39957bc..da2066a 100644 --- a/project/middleware.go +++ b/project/middleware.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/LuminalHQ/zim/store" + "github.com/fugue/zim/store" ) // BufferedOutput is middleware that shows rule stdout and stderr diff --git a/project/project.go b/project/project.go index 7ed8c31..2e427ec 100644 --- a/project/project.go +++ b/project/project.go @@ -10,7 +10,7 @@ import ( "strings" "sync" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" "github.com/hashicorp/go-multierror" ) diff --git a/project/project_test.go b/project/project_test.go index 66f25ac..f3df94b 100644 --- a/project/project_test.go +++ b/project/project_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" ) func testDir(parent ...string) string { diff --git a/project/rule.go b/project/rule.go index f350316..924ebcb 100644 --- a/project/rule.go +++ b/project/rule.go @@ -5,7 +5,7 @@ import ( "path" "strings" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" ) // Dependency on another Component (a Rule or an Export) diff --git a/project/runner_test.go b/project/runner_test.go index 8e9ade4..44cb73b 100644 --- a/project/runner_test.go +++ b/project/runner_test.go @@ -9,7 +9,7 @@ import ( "path" "testing" - "github.com/LuminalHQ/zim/definitions" + "github.com/fugue/zim/definitions" gomock "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/project/term.go b/project/term.go index 2786ada..c1915ef 100644 --- a/project/term.go +++ b/project/term.go @@ -5,7 +5,7 @@ import ( "time" tm "github.com/buger/goterm" - "github.com/LuminalHQ/zim/queue" + "github.com/fugue/zim/queue" "github.com/fatih/color" ) diff --git a/sched/interface.go b/sched/interface.go index df5dc23..942a677 100644 --- a/sched/interface.go +++ b/sched/interface.go @@ -3,7 +3,7 @@ package sched import ( "context" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/project" ) // Options used to configure the Scheduler diff --git a/sched/sched.go b/sched/sched.go index f798e4b..41d9e00 100644 --- a/sched/sched.go +++ b/sched/sched.go @@ -6,8 +6,8 @@ import ( "sort" "time" - "github.com/LuminalHQ/zim/graph" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/graph" + "github.com/fugue/zim/project" "github.com/hashicorp/go-multierror" ) diff --git a/sched/sched_test.go b/sched/sched_test.go index 9cd9268..d58c919 100644 --- a/sched/sched_test.go +++ b/sched/sched_test.go @@ -7,8 +7,8 @@ import ( "path" "testing" - "github.com/LuminalHQ/zim/definitions" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/definitions" + "github.com/fugue/zim/project" "github.com/stretchr/testify/require" ) diff --git a/sched/worker.go b/sched/worker.go index f703dfa..086649b 100644 --- a/sched/worker.go +++ b/sched/worker.go @@ -3,7 +3,7 @@ package sched import ( "context" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/project" ) // workerResult contains the results of running a rule diff --git a/sched/worker_test.go b/sched/worker_test.go index a420c1c..237e006 100644 --- a/sched/worker_test.go +++ b/sched/worker_test.go @@ -8,8 +8,8 @@ import ( "path" "testing" - "github.com/LuminalHQ/zim/definitions" - "github.com/LuminalHQ/zim/project" + "github.com/fugue/zim/definitions" + "github.com/fugue/zim/project" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/signer/main.go b/signer/main.go index 8ae2843..f823405 100644 --- a/signer/main.go +++ b/signer/main.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "github.com/LuminalHQ/zim/sign" + "github.com/fugue/zim/sign" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-sdk-go/aws" diff --git a/slave/slave.go b/slave/slave.go index d80f306..bec0703 100644 --- a/slave/slave.go +++ b/slave/slave.go @@ -9,12 +9,12 @@ import ( "os" "time" - "github.com/LuminalHQ/zim/git" + "github.com/fugue/zim/git" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" - "github.com/LuminalHQ/zim/project" - "github.com/LuminalHQ/zim/queue" - "github.com/LuminalHQ/zim/store" + "github.com/fugue/zim/project" + "github.com/fugue/zim/queue" + "github.com/fugue/zim/store" ) // Opts contains options used for running a Slave diff --git a/store/http.go b/store/http.go index d96b30c..c40f4dc 100644 --- a/store/http.go +++ b/store/http.go @@ -14,7 +14,7 @@ import ( "path" "strings" - "github.com/LuminalHQ/zim/sign" + "github.com/fugue/zim/sign" ) type httpStore struct {