Skip to content
This repository has been archived by the owner on Nov 20, 2021. It is now read-only.

v1.0.0 #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ steps:
event:
- push

- name: manager-testing
- name: e2e
image: golang:1.14
volumes:
- name: gocache
path: /go
commands:
- go test -v ./pkg/manager -test.long
- make test-e2e
when:
branch:
- master
Expand Down
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ builds:
- all=-trimpath={{.Env.GOPATH}}
ldflags:
- -s -w
- -X "github.com/criticalstack/e2d/pkg/buildinfo.Date={{.Date}}"
- -X "github.com/criticalstack/e2d/pkg/buildinfo.GitSHA={{.ShortCommit}}"
- -X "github.com/criticalstack/e2d/pkg/buildinfo.Version={{.Tag}}"
- -X "github.com/criticalstack/e2d/internal/buildinfo.Date={{.Date}}"
- -X "github.com/criticalstack/e2d/internal/buildinfo.GitSHA={{.ShortCommit}}"
- -X "github.com/criticalstack/e2d/internal/buildinfo.Version={{.Tag}}"
archives:
- replacements:
darwin: Darwin
Expand All @@ -55,7 +55,7 @@ nfpms:
- /etc/systemd/system/e2d.service.d
- /var/lib/etcd
files:
deploy/e2d.service: /etc/systemd/system/e2d.service
build/e2d.service: /etc/systemd/system/e2d.service
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
59 changes: 29 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
# If you update this file, please follow
# https://suva.sh/posts/well-documented-makefiles

.DEFAULT_GOAL:=help

ifeq ($(GOPROXY),)
export GOPROXY = direct
endif

# Directories.
TOOLS_DIR := hack/tools
BIN_DIR ?= bin
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
BIN_DIR := bin

# Binaries.
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint

# Golang build env
LDFLAGS := -s -w

GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD | sed 's/\///g')
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_SHA = $(shell git rev-parse --short HEAD)
Expand All @@ -28,29 +15,36 @@ ifneq ($(GIT_TAG),)
VERSION = $(GIT_TAG)
endif

LDFLAGS += -X "github.com/criticalstack/e2d/pkg/buildinfo.Date=$(shell date -u +'%Y-%m-%dT%TZ')"
LDFLAGS += -X "github.com/criticalstack/e2d/pkg/buildinfo.GitSHA=$(GIT_SHA)"
LDFLAGS += -X "github.com/criticalstack/e2d/pkg/buildinfo.Version=$(VERSION)"
LDFLAGS := -s -w
LDFLAGS += -X "github.com/criticalstack/e2d/internal/buildinfo.Date=$(shell date -u +'%Y-%m-%dT%TZ')"
LDFLAGS += -X "github.com/criticalstack/e2d/internal/buildinfo.GitSHA=$(GIT_SHA)"
LDFLAGS += -X "github.com/criticalstack/e2d/internal/buildinfo.Version=$(VERSION)"
GOFLAGS = -gcflags "all=-trimpath=$(PWD)" -asmflags "all=-trimpath=$(PWD)"

GO_BUILD_ENV_VARS := GO111MODULE=on CGO_ENABLED=0

.PHONY: build test test-manager clean
##@ Building

build: clean ## Build the e2d golang binary
.PHONY: e2d

e2d: ## Build the e2d golang binary
$(GO_BUILD_ENV_VARS) go build -o bin/e2d $(GOFLAGS) -ldflags '$(LDFLAGS)' ./cmd/e2d

test: ## Run all tests
go test ./...
.PHONY: update-codegen
update-codegen: ## Update generated code (slow)
@echo "Updating generated code files ..."
@echo " *** This can be slow and does not need to run every build ***"
@hack/tools/update-codegen.sh

test-manager: ## Test the manager package
go test ./pkg/manager -test.long
##@ Testing

clean: ## Cleanup the project folders
@rm -rf ./bin/*
@rm -rf hack/tools/bin
.PHONY: test test-e2e lint lint-full

test: ## Run all tests
@go test $(shell go list ./... | grep -v e2e)

.PHONY: lint
test-e2e: ## Run e2e tests
@go test ./e2e -parallel=16 -count=1

lint: $(GOLANGCI_LINT) ## Lint codebase
$(GOLANGCI_LINT) run -v
Expand All @@ -60,15 +54,20 @@ lint-full: $(GOLANGCI_LINT) ## Run slower linters to detect possible issues

##@ Helpers

.PHONY: help
.PHONY: help clean

$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod # Build golangci-lint from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint

clean: ## Cleanup the project folders
@rm -rf ./bin/*
@rm -rf hack/tools/bin

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


# TODO: move to hack/tools
generate:
protoc -I pkg/manager/e2dpb \
-I vendor/ \
Expand Down
Loading