forked from sablierapp/sablier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (76 loc) · 3.22 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
PLATFORMS := linux/amd64 linux/arm64 linux/arm/v7 linux/arm
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
VERSION = draft
# Version info for binaries
GIT_REVISION := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
BUILDTIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILDUSER := $(shell whoami)@$(shell hostname)
VPREFIX := github.com/sablierapp/sablier/version
GO_LDFLAGS := -s -w -X $(VPREFIX).Branch=$(GIT_BRANCH) -X $(VPREFIX).Version=$(VERSION) -X $(VPREFIX).Revision=$(GIT_REVISION) -X $(VPREFIX).BuildUser=$(BUILDUSER) -X $(VPREFIX).BuildDate=$(BUILDTIME)
$(PLATFORMS):
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build -trimpath -tags=nomsgpack -v -ldflags="${GO_LDFLAGS}" -o 'sablier_$(VERSION)_$(os)-$(arch)' .
build:
go build -v .
test:
go test -v ./...
plugins: build-plugin-traefik test-plugin-traefik build-plugin-caddy test-plugin-caddy
build-plugin-traefik:
cd plugins/traefik && go build -v .
test-plugin-traefik:
cd plugins/traefik && go test -v ./...
build-plugin-caddy:
cd plugins/caddy && go build -v .
test-plugin-caddy:
cd plugins/caddy && go test -v .
.PHONY: docker
docker:
docker build --build-arg BUILDTIME=$(BUILDTIME) --build-arg VERSION=$(VERSION) --build-arg REVISION=$(GIT_REVISION) -t sablierapp/sablier:local .
caddy:
docker build -t caddy:local plugins/caddy
release: $(PLATFORMS)
proxywasm:
go generate ./plugins/proxywasm
tinygo build -ldflags "-X 'main.Version=$(VERSION)'" -o ./plugins/proxywasm/sablierproxywasm.wasm -scheduler=none -target=wasi ./plugins/proxywasm
cp ./plugins/proxywasm/sablierproxywasm.wasm ./sablierproxywasm_$(VERSION).wasm
.PHONY: release $(PLATFORMS)
LAST = 0.0.0
NEXT = 1.0.0
update-doc-version:
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/sablierapp\/sablier:$(LAST)/sablierapp\/sablier:$(NEXT)/g' {} +
update-doc-version-middleware:
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/version: "v$(LAST)"/version: "v$(NEXT)"/g' {} +
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/version=v$(LAST)/version=v$(NEXT)/g' {} +
sed -i 's/SABLIER_VERSION=v$(LAST)/SABLIER_VERSION=v$(NEXT)/g' plugins/caddy/remote.Dockerfile
sed -i 's/v$(LAST)/v$(NEXT)/g' plugins/caddy/README.md
.PHONY: docs
docs:
npx --yes docsify-cli serve docs
# End to end tests
e2e: e2e-caddy e2e-nginx e2e-traefik
## Caddy
e2e-caddy-docker:
cd plugins/caddy/e2e/docker && bash ./run.sh
e2e-caddy-swarm:
cd plugins/caddy/e2e/docker_swarm && bash ./run.sh
# e2e-caddy-kubernetes:
# cd plugins/caddy/e2e/kubernetes && bash ./run.sh
e2e-caddy: e2e-caddy-docker e2e-caddy-swarm # e2e-caddy-kubernetes
## NGinx
e2e-nginx-docker:
cd plugins/nginx/e2e/docker && bash ./run.sh
e2e-nginx-swarm:
cd plugins/nginx/e2e/docker_swarm && bash ./run.sh
e2e-nginx-kubernetes:
cd plugins/nginx/e2e/kubernetes && bash ./run.sh
e2e-nginx: e2e-nginx-docker e2e-nginx-swarm e2e-nginx-kubernetes
## Traefik
e2e-traefik-docker:
cd plugins/traefik/e2e/docker && bash ./run.sh
e2e-traefik-swarm:
cd plugins/traefik/e2e/docker_swarm && bash ./run.sh
e2e-traefik-kubernetes:
cd plugins/traefik/e2e/kubernetes && bash ./run.sh
e2e-traefik: e2e-traefik-docker e2e-traefik-swarm e2e-traefik-kubernetes