blob: 94a968b732f0067048b68bc47db88d0b32ba41ec (
plain)
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
|
version: '3'
vars:
BINARY_NAME: gitsyncer
BUILD_DIR: .
CMD_PATH: ./cmd/gitsyncer
LDFLAGS: -s -w
tasks:
default:
desc: Build the gitsyncer binary
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_PATH}}
build:
desc: Build the gitsyncer binary
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.CMD_PATH}}
build-all:
desc: Build for all supported platforms
cmds:
- task: build-linux
- task: build-darwin
- task: build-windows
build-linux:
desc: Build for Linux
cmds:
- GOOS=linux GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-amd64 {{.CMD_PATH}}
build-darwin:
desc: Build for macOS
cmds:
- GOOS=darwin GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-amd64 {{.CMD_PATH}}
- GOOS=darwin GOARCH=arm64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-arm64 {{.CMD_PATH}}
build-windows:
desc: Build for Windows
cmds:
- GOOS=windows GOARCH=amd64 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-windows-amd64.exe {{.CMD_PATH}}
run:
desc: Build and run the gitsyncer binary
cmds:
- task: build
- ./{{.BINARY_NAME}}
test:
desc: Run tests
cmds:
- go test ./...
test-verbose:
desc: Run tests with verbose output
cmds:
- go test -v ./...
clean:
desc: Clean build artifacts
cmds:
- rm -f {{.BINARY_NAME}}
- rm -f {{.BINARY_NAME}}-*
mod-tidy:
desc: Tidy go modules
cmds:
- go mod tidy
fmt:
desc: Format Go code
cmds:
- go fmt ./...
vet:
desc: Run go vet
cmds:
- go vet ./...
lint:
desc: Run golangci-lint
cmds:
- golangci-lint run
install:
desc: Install gitsyncer to $GOPATH/bin
cmds:
- go install {{.CMD_PATH}}
version:
desc: Show version
deps: [build]
cmds:
- ./{{.BINARY_NAME}} --version
|