Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (90 loc) · 3.07 KB
/
Copy pathMakefile
File metadata and controls
127 lines (90 loc) · 3.07 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
BIN := ./webhookdb
ARGS := WEBHOOKDB_API_HOST=http://localhost:18001
BUILDFLAGS = "-X github.com/webhookdb/webhookdb-cli/config.BuildTime=`date +"%Y-%m-%dT%H:%M:%SZ"` -X github.com/webhookdb/webhookdb-cli/config.BuildSha=`git rev-list -1 HEAD` -X github.com/webhookdb/webhookdb-cli/config.Version=`git rev-parse --abbrev-ref HEAD`"
WEBSITE = ../webhookdb-api/webhookdb-website
ifdef GOROOT
GO := $(GOROOT)/bin/go
else
GO := go
endif
guardcmd-%:
@hash $(*) > /dev/null 2>&1 || \
(echo "ERROR: '$(*)' must be installed and available on your PATH."; exit 1)
guardenv-%:
@if [ -z '${${*}}' ]; then echo 'ERROR: environment variable $* not set' && exit 1; fi
fmt:
@go fmt ./...
lint: guardcmd-gofmt
@test -z $$(gofmt -d -l . | tee /dev/stderr) && echo "gofmt ok"
vet:
@$(GO) vet && echo "go vet ok"
test:
$(GO) test .
@WEBHOOKDB_LOG_LEVEL=fatal ginkgo -r --trace --race --progress --skipMeasurements
test-watch:
@WEBHOOKDB_LOG_LEVEL=fatal ginkgo watch ./...
update-test-snapshots:
UPDATE_SNAPSHOTS=true make test
bench:
@WEBHOOKDB_LOG_LEVEL=fatal ginkgo -r --focus=benchmarks
check: vet lint
build:
@$(GO) build -ldflags $(BUILDFLAGS) -o webhookdb
build-arm64:
@GOOS=darwin $(GO) build -ldflags $(BUILDFLAGS) -o webhookdb
build-wasm:
@GOOS=js GOARCH=wasm $(GO) build -ldflags $(BUILDFLAGS) -o webhookdb.wasm
_goreleaser-clean:
rm -rf ./dist
goreleaser-build: _goreleaser-clean
goreleaser build
goreleaser-local: _goreleaser-clean
GITHUB_TOKEN=notreal goreleaser
wasm-server:
$(GO) run bin/serve-wasm/main.go
build-all: build-arm64 build build-wasm
docker-build:
docker build -f Dockerfile -t webhookdb-cli \
--build-arg GIT_SHA=`git rev-list --abbrev-commit -1 HEAD` \
--build-arg GIT_REF=`git rev-parse --abbrev-ref HEAD` \
.
docker-run-version:
@docker run -it webhookdb-cli version --time
docker-run-%:
@docker run -v ~/.webhookdb/dockercli:/root -it webhookdb-cli $(*)
dockerhub-run-version:
@docker run -it webhookdb/webhookdb-cli:latest version --time
docs: build
@DOCBUILD=true $(BIN) docs build
docs-write: build ## Write a new copy of MANUAL.md.
@DOCBUILD=true $(BIN) docs build > MANUAL.md
docs-site: build ## Write MANUAL.md to the docs site.
@DOCBUILD=true $(BIN) docs build --docsite > ../webhookdb/docs/docs/cli-reference.md
update-lithic-deps:
$(GO) get github.com/rgalanakis/golangal@latest
$(GO) get github.com/lithictech/go-aperitif@latest
help:
@$(GO) run ./main.go help
itest-auth-login: build
$(ARGS) $(BIN) auth login --username=alpha@webhookdb.com
itest-auth-otp-%: build
$(ARGS) $(BIN) auth login --username=alpha@webhookdb.com --token=$(*)
itest-auth-logout: build
$(ARGS) $(BIN) auth logout
#
#itest-integrations-create: build
# $(ARGS) $(BIN) integrations create fake_v1
# SERVICES
itest-services-list: build
$(ARGS) $(BIN) services list
# ORGS
itest-org-invite-%: build
$(ARGS) $(BIN) org invite --username=$(*)
itest-org-join-%: build
$(ARGS) $(BIN) org join $(*)
itest-org-list: build
$(ARGS) $(BIN) org list
itest-org-members: build
$(ARGS) $(BIN) org members
itest-org-members-%: build
$(ARGS) $(BIN) org members --org=$(*)