-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (114 loc) · 5.2 KB
/
Makefile
File metadata and controls
142 lines (114 loc) · 5.2 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
138
139
140
141
142
VERSION=$(if $(RELEASE_VERSION),$(RELEASE_VERSION),UNSTABLE)
$(info VERSION: $(VERSION))
DARWIN=qshell-$(VERSION)-darwin-x64
DARWINARM64=qshell-$(VERSION)-darwin-arm64
LINUX86=qshell-$(VERSION)-linux-x86
LINUX64=qshell-$(VERSION)-linux-x64
LINUXARM=qshell-$(VERSION)-linux-arm
LINUXARM64=qshell-$(VERSION)-linux-arm64
LINUXMIPS=qshell-$(VERSION)-linux-mips
LINUXMIPSLE=qshell-$(VERSION)-linux-mipsle
LINUXMIPS64=qshell-$(VERSION)-linux-mips64
LINUXMIPS64LE=qshell-$(VERSION)-linux-mips64le
LINUXLOONG64=qshell-$(VERSION)-linux-loong64
LINUXRISCV64=qshell-$(VERSION)-linux-riscv64
WIN86=qshell-$(VERSION)-windows-x86
WIN64=qshell-$(VERSION)-windows-x64
WINARM=qshell-$(VERSION)-windows-arm
WINARM64=qshell-$(VERSION)-windows-arm64
LDFLAGS='-X 'github.com/qiniu/qshell/v2/iqshell/common/version.version=$(VERSION)' -extldflags '-static''
GO=GO111MODULE=on go
all: linux windows darwin
.PHONY: linux windows darwin
darwin: $(DARWIN).zip $(DARWINARM64).zip
linux: $(LINUX86).zip $(LINUX64).zip $(LINUXARM).zip $(LINUXARM64).zip $(LINUXMIPS).zip $(LINUXMIPSLE).zip $(LINUXMIPS64).zip $(LINUXMIPS64LE).zip $(LINUXLOONG64).zip $(LINUXRISCV64).zip
windows: $(WIN86).zip $(WIN64).zip $(WINARM).zip $(WINARM64).zip
qshell-$(VERSION)-darwin-%.zip: qshell-$(VERSION)-darwin-%
zip $@ $<
qshell-$(VERSION)-linux-%.zip: qshell-$(VERSION)-linux-%
zip $@ $<
qshell-$(VERSION)-windows-%.zip: qshell-$(VERSION)-windows-%.exe
zip $@ $<
$(DARWIN):
GOOS=darwin GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWIN) ./main/
$(DARWINARM64):
GOOS=darwin GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(DARWINARM64) ./main/
$(LINUX86):
CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX86) ./main/
$(LINUX64):
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUX64) ./main/
$(LINUXARM):
CGO_ENABLED=0 GOOS=linux GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM) ./main/
$(LINUXARM64):
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXARM64) ./main/
$(LINUXMIPS):
CGO_ENABLED=0 GOOS=linux GOARCH=mips $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS) ./main/
$(LINUXMIPSLE):
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPSLE) ./main/
$(LINUXMIPS64):
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64) ./main/
$(LINUXMIPS64LE):
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le $(GO) build -ldflags $(LDFLAGS) -o $(LINUXMIPS64LE) ./main/
$(LINUXLOONG64):
CGO_ENABLED=0 GOOS=linux GOARCH=loong64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXLOONG64) ./main/
$(LINUXRISCV64):
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 $(GO) build -ldflags $(LDFLAGS) -o $(LINUXRISCV64) ./main/
$(WIN86).exe:
CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build -ldflags $(LDFLAGS) -o $(WIN86).exe ./main/
$(WIN64).exe:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build -ldflags $(LDFLAGS) -o $(WIN64).exe ./main/
$(WINARM).exe:
CGO_ENABLED=0 GOOS=windows GOARCH=arm $(GO) build -ldflags $(LDFLAGS) -o $(WINARM).exe ./main/
$(WINARM64).exe:
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 $(GO) build -ldflags $(LDFLAGS) -o $(WINARM64).exe ./main/
# --- Lint targets ---
.PHONY: lint vet staticcheck
lint: vet staticcheck
vet:
$(GO) vet ./...
staticcheck:
staticcheck ./...
# --- Test targets ---
.PHONY: test test-unit test-integration test-sandbox test-sandbox-unit test-sandbox-integration
# Run all unit tests (no build tags, safe to run without credentials)
test:
$(GO) test -count=1 ./...
# Run unit-tagged tests in cmd_test
test-unit:
$(GO) test -count=1 -tags unit -v ./cmd_test/ ./iqshell/...
# Run all integration tests (requires QINIU_API_KEY and related credentials)
test-integration:
$(GO) test -count=1 -tags integration -v -timeout 600s ./cmd_test/ ./iqshell/...
# Run sandbox unit tests only
test-sandbox-unit:
$(GO) test -count=1 -v ./iqshell/sandbox/
$(GO) test -count=1 -tags unit -v ./cmd_test/ -run "TestSandbox"
# Run sandbox integration tests (requires QINIU_API_KEY)
test-sandbox-integration:
$(GO) test -count=1 -tags integration -v -timeout 300s ./iqshell/sandbox/
# Run all sandbox tests (unit + integration)
test-sandbox: test-sandbox-unit test-sandbox-integration
# --- Build & release targets ---
.PHONY: cleanzip cleanbin clean upload
cleanzip:
rm -f qshell-$(VERSION)-*.zip
cleanbin:
rm -f qshell-$(VERSION)-*
clean: cleanzip cleanbin
upload:
qshell rput devtools $(DARWIN).zip $(DARWIN).zip
qshell rput devtools $(DARWINARM64).zip $(DARWINARM64).zip
qshell rput devtools $(LINUX86).zip $(LINUX86).zip
qshell rput devtools $(LINUX64).zip $(LINUX64).zip
qshell rput devtools $(LINUXARM).zip $(LINUXARM).zip
qshell rput devtools $(LINUXARM64).zip $(LINUXARM64).zip
qshell rput devtools $(LINUXMIPS).zip $(LINUXMIPS).zip
qshell rput devtools $(LINUXMIPSLE).zip $(LINUXMIPSLE).zip
qshell rput devtools $(LINUXMIPS64).zip $(LINUXMIPS64).zip
qshell rput devtools $(LINUXMIPS64LE).zip $(LINUXMIPS64LE).zip
qshell rput devtools $(LINUXLOONG64).zip $(LINUXLOONG64).zip
qshell rput devtools $(LINUXRISCV64).zip $(LINUXRISCV64).zip
qshell rput devtools $(WIN86).zip $(WIN86).zip
qshell rput devtools $(WIN64).zip $(WIN64).zip
qshell rput devtools $(WINARM).zip $(WINARM).zip
qshell rput devtools $(WINARM64).zip $(WINARM64).zip