-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
105 lines (88 loc) 路 2.67 KB
/
Copy pathTaskfile.yml
File metadata and controls
105 lines (88 loc) 路 2.67 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
# https://taskfile.dev
version: "3"
vars:
VERSION:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "dev"
COMMIT:
sh: git rev-parse --short HEAD 2>/dev/null || echo "unknown"
DATE:
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
LDFLAGS: >-
-s -w
-X github.com/eduardolat/authkeysync/internal/version.Version={{.VERSION}}
-X github.com/eduardolat/authkeysync/internal/version.Commit={{.COMMIT}}
-X github.com/eduardolat/authkeysync/internal/version.Date={{.DATE}}
tasks:
ci:
desc: Run all CI checks (deps, build, lint, test, e2e)
cmds:
- task: deps
- task: build
- task: lint
- task: test
- task: e2e
deps:
desc: Install all dependencies for the project
cmd: go mod download
run:
cmds:
- task: build
- ./dist/authkeysync {{.CLI_ARGS}}
build:
desc: Build the binary for the current platform
cmd: CGO_ENABLED=0 go build -ldflags "{{.LDFLAGS}}" -o dist/authkeysync ./cmd
fmt:
desc: Format all code
cmds:
- go fmt ./...
- cd e2e && go fmt ./...
- dprint fmt
lint:
desc: Run all linters including format check
cmds:
- test -z "$(gofmt -l .)" || (echo "Code is not formatted. Run 'task fmt'" && exit 1)
- golangci-lint run
- dprint check
test:
desc: Run unit tests
cmd: go test -v ./...
e2e:
desc: Run end-to-end tests
cmds:
- task: build
- cd e2e && go test -v -timeout 10m ./...
# Cross-compilation targets for release builds
build-all:
desc: Build binaries for all supported platforms
cmds:
- task: build-linux-amd64
- task: build-linux-arm64
- task: build-darwin-amd64
- task: build-darwin-arm64
- task: build-checksums
build-linux-amd64:
desc: Build for Linux AMD64
cmd: >-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64
go build -ldflags "{{.LDFLAGS}}" -o dist/authkeysync-linux-amd64 ./cmd
build-linux-arm64:
desc: Build for Linux ARM64
cmd: >-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64
go build -ldflags "{{.LDFLAGS}}" -o dist/authkeysync-linux-arm64 ./cmd
build-darwin-amd64:
desc: Build for macOS AMD64
cmd: >-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64
go build -ldflags "{{.LDFLAGS}}" -o dist/authkeysync-darwin-amd64 ./cmd
build-darwin-arm64:
desc: Build for macOS ARM64 (Apple Silicon)
cmd: >-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64
go build -ldflags "{{.LDFLAGS}}" -o dist/authkeysync-darwin-arm64 ./cmd
build-checksums:
desc: Generate checksums for all binaries in dist/
cmd: cd dist && sha256sum authkeysync-* > checksums.txt
clean:
desc: Remove build artifacts
cmd: rm -rf dist/