-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 1.62 KB
/
Makefile
File metadata and controls
64 lines (46 loc) · 1.62 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
.PHONY: fmt lint test
ifeq ($(OS),Windows_NT)
RM := del /Q
UPX := upx.exe
BIN := bin/auto-commit
else
RM := rm -f
UPX := upx
BIN := ./bin/auto-commit
endif
fmt:
gofmt -w .
goimports -w .
lint:
golangci-lint run
check: fmt lint test
@echo "All checks passed!"
build:
@echo "Running build..."
@find . -type f -name "*.sh" -exec sed -i 's/\r$$//' {} \;
@go build -o $(BIN) ./cmd
buildrelease:
@echo "Running release build (windows, linux)..."
@find . -type f -name "*.sh" -exec sed -i 's/\r$$//' {} \;
# windows
@GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/auto-commit-windows-amd64 ./cmd
upx.exe --best --lzma bin/auto-commit-windows-amd64 || true
# linux amd64
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/auto-commit-linux-amd64 ./cmd
upx --best --lzma bin/auto-commit-linux-amd64 || true
# linux arm64
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/auto-commit-linux-arm64 ./cmd
upx --best --lzma bin/auto-commit-linux-arm64 || true
# macOS (Intel)
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/auto-commit-macos-amd64 ./cmd
# macOS (Apple Silicon / M1, M2)
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/auto-commit-macos-arm64 ./cmd
buildrelease-update:
@echo "Running release build update..."
@find . -type f -name "*.sh" -exec sed -i 's/\r$$//' {} \;
@go build -ldflags="-s -w" -trimpath -o $(BIN).update ./cmd
$(UPX) --best --lzma $(BIN).update || true
test:
@go test -v ./...
run: build
@./bin/auto-commit