forked from gomods/athens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (90 loc) · 3.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
VERSION = "unset"
DATE=$(shell date -u +%Y-%m-%d-%H:%M:%S-%Z)
ifndef GOLANG_VERSION
override GOLANG_VERSION = 1.12
endif
.PHONY: build
build: ## build the athens proxy
cd cmd/proxy && go build
build-ver: ## build the athens proxy with version number
GO111MODULE=on CGO_ENABLED=0 GOPROXY="https://proxy.golang.org" go build -ldflags "-X github.com/gomods/athens/pkg/build.version=$(VERSION) -X github.com/gomods/athens/pkg/build.buildDate=$(DATE)" -o athens ./cmd/proxy
# The build-image step creates a docker image that has all the tools required
# to perform some CI build steps, instead of relying on them being installed locally
.PHONY: build-image
build-image:
docker build -t athens-build ./scripts/build-image
.PHONY: run
run: ## run the athens proxy with dev configs
cd ./cmd/proxy && go run . -config_file ../../config.dev.toml
.PHONY: run-docker
run-docker:
docker-compose -p athensdockerdev up -d dev
.PHONY: run-docker-teardown
run-docker-teardown:
docker-compose -p athensdockerdev down
.PHONY: docs
docs: ## build the docs docker image
docker build -t gomods/hugo -f docs/Dockerfile .
.PHONY: setup-dev-env
setup-dev-env:
./scripts/get_dev_tools.sh
$(MAKE) dev
.PHONY: verify
verify: ## verify athens codebase
./scripts/check_gofmt.sh
./scripts/check_golint.sh
./scripts/check_deps.sh
./scripts/check_conflicts.sh
.PHONY: test-unit
test-unit: ## run unit tests with race detector and code coverage enabled
./scripts/test_unit.sh
.PHONY: test-unit-docker
test-unit-docker: ## run unit tests with docker
docker-compose -p athensunit build --build-arg GOLANG_VERSION=${GOLANG_VERSION} testunit
docker-compose -p athensunit up --exit-code-from=testunit testunit
docker-compose -p athensunit down
.PHONY: test-e2e
test-e2e:
./scripts/test_e2e.sh
.PHONY: test-e2e-docker
test-e2e-docker:
docker-compose -p athense2e build --build-arg GOLANG_VERSION=${GOLANG_VERSION} teste2e
docker-compose -p athense2e up --exit-code-from=teste2e teste2e
docker-compose -p athense2e down
.PHONY: docker
docker: proxy-docker
.PHONY: proxy-docker
proxy-docker:
docker build -t gomods/athens -f cmd/proxy/Dockerfile .
.PHONY: docker-push
docker-push:
./scripts/push-docker-images.sh
.PHONY: charts-push
charts-push: build-image
docker run --rm -it \
-v `pwd`:/go/src/github.com/gomods/athens \
-e AZURE_STORAGE_CONNECTION_STRING \
-e CHARTS_REPO \
athens-build ./scripts/push-helm-charts.sh
bench:
./scripts/benchmark.sh
.PHONY: alldeps
alldeps:
docker-compose -p athensdev up -d mongo
docker-compose -p athensdev up -d minio
docker-compose -p athensdev up -d jaeger
echo "sleeping for a bit to wait for the DB to come up"
sleep 5
.PHONY: dev
dev:
docker-compose -p athensdev up -d mongo
docker-compose -p athensdev up -d minio
.PHONY: down
down:
docker-compose -p athensdev down -v
.PHONY: dev-teardown
dev-teardown:
docker-compose -p athensdev down -v
.PHONY: help
help: ## display help page
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'