-
Notifications
You must be signed in to change notification settings - Fork 413
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (116 loc) · 3.83 KB
/
Makefile
File metadata and controls
137 lines (116 loc) · 3.83 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
128
129
130
131
132
133
134
135
136
137
LINUX_PKGS := $(wildcard dist/*.deb) $(wildcard dist/*.rpm)
.PHONY: fury $(LINUX_PKGS)
fury: $(LINUX_PKGS)
$(LINUX_PKGS):
fury push --as distribworks $@
PACKAGE_NAME := github.com/distribworks/dkron
GOLANG_CROSS_VERSION ?= v1.26
.PHONY: release-dry-run
release-dry-run:
@docker run \
--rm \
--privileged \
-v ${PWD}:/dkron \
-w /dkron \
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
-e DOCKER_REGISTRY \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip=validate,publish --timeout=1h --parallelism=1
.PHONY: release
release:
@docker run \
--rm \
--privileged \
-v ${PWD}:/dkron \
-w /dkron \
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
-e DOCKER_REGISTRY \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip=validate --timeout=1h
.PHONY: clean
clean:
rm -f main
rm -f *_SHA256SUMS
rm -f dkron-*
rm -rf build/*
rm -rf builder/skel/*
rm -f *.deb
rm -f *.rpm
rm -f *.tar.gz
rm -rf tmp
rm -rf ui-dist
rm -rf ui/build
rm -rf ui/node_modules
GOBIN=`pwd` go clean -i ./builtin/...
GOBIN=`pwd` go clean
.PHONY: docs apidoc test ui updatetestcert test-email
docs:
# scripts/run doc --dir website/docs/cli
cd website; pnpm build --out-dir ../public
ghp-import -p public
test:
@bash --norc -i ./scripts/test
localtest:
go test -v ./... | sed ''/PASS/s//$$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$$(printf "\033[31mFAIL\033[0m")/''
test-email:
@echo "Starting Mailpit for email testing..."
@docker run -d --rm --name dkron-mailpit -p 8025:8025 -p 1025:1025 axllent/mailpit 2>/dev/null || true
@echo "Mailpit started. Web UI available at http://localhost:8025"
@echo "Running email notification tests..."
@go test -v -run TestNotifier_sendExecutionEmail ./dkron
@echo "Tests complete. View captured emails at http://localhost:8025"
@echo "To stop Mailpit, run: docker stop dkron-mailpit"
# E2E tests - run full test suite with build
e2e:
@echo "Running E2E tests..."
./e2e/run-e2e-tests.sh
# E2E tests - run without rebuilding
e2e-quick:
@echo "Running E2E tests (no build)..."
./e2e/run-e2e-tests.sh --no-build
# E2E tests - keep cluster running after tests for debugging
e2e-debug:
@echo "Running E2E tests (keeping cluster running)..."
./e2e/run-e2e-tests.sh --keep
updatetestcert:
wget https://badssl.com/certs/badssl.com-client.p12 -q -O badssl.com-client.p12
openssl pkcs12 -in badssl.com-client.p12 -nocerts -nodes -passin pass:badssl.com -legacy -out plugin/http/testdata/badssl.com-client-key-decrypted.pem
openssl pkcs12 -in badssl.com-client.p12 -nokeys -passin pass:badssl.com -legacy -out plugin/http/testdata/badssl.com-client.pem
rm badssl.com-client.p12
ui/node_modules: ui/package.json
cd ui; pnpm install
# touch the directory so Make understands it is up to date
touch ui/node_modules
dkron/ui-dist: ui/node_modules ui/public/* ui/src/* ui/src/*/*
rm -rf dkron/ui-dist
cd ui; pnpm build --out-dir ../dkron/ui-dist
# deprecated
# proto: types/dkron.pb.go types/executor.pb.go types/pro.pb.go
.PHONY: proto
proto:
@echo "Generating protobuf files using Buf"
buf generate
lint: proto-lint
proto-lint:
@echo "Linting protobuf files using Buf"
buf lint
# deprecated
types/%.pb.go: proto/%.proto
protoc -I proto/ --go_out=types --go_opt=paths=source_relative --go-grpc_out=types --go-grpc_opt=paths=source_relative $<
client:
oapi-codegen -package client website/static/openapi/openapi.yaml > client/client.go
ui: dkron/ui-dist
main: dkron/ui-dist types/dkron.pb.go types/executor.pb.go *.go */*.go */*/*.go */*/*/*.go
GOBIN=`pwd` go install ./builtin/...
go mod tidy
go build main.go