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

Commit dd96f66

Browse files
committed
[WIP] v1.0.0
1 parent 15cd873 commit dd96f66

74 files changed

Lines changed: 4019 additions & 3942 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ steps:
2222
event:
2323
- push
2424

25-
- name: manager-testing
25+
- name: e2e
2626
image: golang:1.14
2727
volumes:
2828
- name: gocache
2929
path: /go
3030
commands:
31-
- go test -v ./pkg/manager -test.long
31+
- make test-e2e
3232
when:
3333
branch:
3434
- master

.goreleaser.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ builds:
2626
- all=-trimpath={{.Env.GOPATH}}
2727
ldflags:
2828
- -s -w
29-
- -X "github.com/criticalstack/e2d/pkg/buildinfo.Date={{.Date}}"
30-
- -X "github.com/criticalstack/e2d/pkg/buildinfo.GitSHA={{.ShortCommit}}"
31-
- -X "github.com/criticalstack/e2d/pkg/buildinfo.Version={{.Tag}}"
29+
- -X "github.com/criticalstack/e2d/internal/buildinfo.Date={{.Date}}"
30+
- -X "github.com/criticalstack/e2d/internal/buildinfo.GitSHA={{.ShortCommit}}"
31+
- -X "github.com/criticalstack/e2d/internal/buildinfo.Version={{.Tag}}"
3232
archives:
3333
- replacements:
3434
darwin: Darwin
@@ -55,7 +55,7 @@ nfpms:
5555
- /etc/systemd/system/e2d.service.d
5656
- /var/lib/etcd
5757
files:
58-
deploy/e2d.service: /etc/systemd/system/e2d.service
58+
build/e2d.service: /etc/systemd/system/e2d.service
5959
checksum:
6060
name_template: 'checksums.txt'
6161
snapshot:

Makefile

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
# If you update this file, please follow
2-
# https://suva.sh/posts/well-documented-makefiles
3-
41
.DEFAULT_GOAL:=help
52

6-
ifeq ($(GOPROXY),)
7-
export GOPROXY = direct
8-
endif
9-
10-
# Directories.
11-
TOOLS_DIR := hack/tools
3+
BIN_DIR ?= bin
4+
TOOLS_DIR := hack/tools
125
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
13-
BIN_DIR := bin
14-
15-
# Binaries.
166
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
177

18-
# Golang build env
19-
LDFLAGS := -s -w
20-
218
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD | sed 's/\///g')
229
GIT_COMMIT = $(shell git rev-parse HEAD)
2310
GIT_SHA = $(shell git rev-parse --short HEAD)
@@ -28,29 +15,36 @@ ifneq ($(GIT_TAG),)
2815
VERSION = $(GIT_TAG)
2916
endif
3017

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

3624
GO_BUILD_ENV_VARS := GO111MODULE=on CGO_ENABLED=0
3725

38-
.PHONY: build test test-manager clean
26+
##@ Building
3927

40-
build: clean ## Build the e2d golang binary
28+
.PHONY: e2d
29+
30+
e2d: ## Build the e2d golang binary
4131
$(GO_BUILD_ENV_VARS) go build -o bin/e2d $(GOFLAGS) -ldflags '$(LDFLAGS)' ./cmd/e2d
4232

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

46-
test-manager: ## Test the manager package
47-
go test ./pkg/manager -test.long
39+
##@ Testing
4840

49-
clean: ## Cleanup the project folders
50-
@rm -rf ./bin/*
51-
@rm -rf hack/tools/bin
41+
.PHONY: test test-e2e lint lint-full
42+
43+
test: ## Run all tests
44+
@go test $(shell go list ./... | grep -v e2e)
5245

53-
.PHONY: lint
46+
test-e2e: ## Run e2e tests
47+
@go test ./e2e -parallel=16 -count=1
5448

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

6155
##@ Helpers
6256

63-
.PHONY: help
57+
.PHONY: help clean
6458

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

62+
clean: ## Cleanup the project folders
63+
@rm -rf ./bin/*
64+
@rm -rf hack/tools/bin
65+
6866
help: ## Display this help
69-
@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)
67+
@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)
7068

7169

70+
# TODO: move to hack/tools
7271
generate:
7372
protoc -I pkg/manager/e2dpb \
7473
-I vendor/ \

0 commit comments

Comments
 (0)