This repository was archived by the owner on Dec 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
58 lines (42 loc) · 2.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
version_pkg := github.com/weaveworks/pctl/pkg/version
build_date := $(shell date +%Y-%m-%dT%H:%M:%SZ)
git_commit = $(shell git rev-parse --short HEAD)
##@ Test
test: lint unit integration docs ## Lint, run all tests and update the docs
unit: ## Run the unit tests
ginkgo -r ./pkg
integration: build test-env ## Run the integration tests
ginkgo -r ./tests/...
test-env: submodule ## Create an environment for tests
cd dependencies/profiles && make docker-build-local kind-up docker-push-local
flux install --components="source-controller,helm-controller,kustomize-controller" --log-level debug
##@ Build
lint: ## Run the linter
golangci-lint run --exclude-use-default=false --timeout=5m0s
build: ## Build the pctl binary to ./pctl
CGO_ENABLED=0 go build -ldflags "-X $(version_pkg).GitCommit=$(git_commit) -X $(version_pkg).BuildDate=$(build_date)" -o pctl ./cmd/pctl
local-env: submodule ## Create local environment
cd dependencies/profiles && make local-env
kubectl apply -f dependencies/profiles/examples/profile-catalog-source.yaml
submodule: ## Update git submodules
git submodule init
git submodule update
##@ Docs
docs: mdtoc ## Update the Readme
mdtoc -inplace README.md
mdtoc: ## Download mdtoc binary if necessary
GO111MODULE=off go get sigs.k8s.io/mdtoc || true
##@ Utility
.PHONY: help
help: ## Display this help. Thanks to https://www.thapaliya.com/en/writings/well-documented-makefiles/
ifeq ($(OS),Windows_NT)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n"} /^[a-zA-Z_-]+:.*?##/ { printf " %-30s %s\n", $$1, $$2 } /^##@/ { printf "\n%s\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
else
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
endif
update-modules: ## Update specific dependencies to pctl with regards to profiles especially
go get \
$(shell doki mod latest \
github.com/weaveworks/profiles \
)
go mod tidy