-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
92 lines (78 loc) · 2.6 KB
/
Copy pathTaskfile.yml
File metadata and controls
92 lines (78 loc) · 2.6 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
version: "3"
vars:
BINARY: harness
MAIN: ./cmd/harness/main-harness.go
VERSION:
sh: echo "${VERSION:-$(go run ./cmd/getversion/main-getversion.go --next)-dev}"
BUILD_TIME:
sh: date -u +%Y%m%d%H%MZ
SEGMENT_WRITE_KEY: '{{default "" (env "SEGMENT_WRITE_KEY")}}'
LDFLAGS: >-
-X github.com/harness/cli/pkg/hbase.Version={{.VERSION}}
-X github.com/harness/cli/pkg/hbase.BuildTime={{.BUILD_TIME}}
-X github.com/harness/cli/pkg/telemetry.segmentWriteKey={{.SEGMENT_WRITE_KEY}}
tasks:
build:
desc: Build all binaries
deps: [build:main, build:har]
build:main:
desc: Build the harness binary
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o bin/{{.BINARY}} {{.MAIN}}
build:har:
desc: Build the harness-har binary (HAR external module)
dir: modules/har
cmds:
- go build -ldflags "{{.LDFLAGS}}" -o ../../bin/harness-har ./cmd/harness-har/main-harness-har.go
build:opt:
desc: Build all optimized binaries (stripped symbols, no DWARF)
deps: [build:opt:main, build:opt:har]
build:opt:main:
desc: Build optimized harness binary
cmds:
- go build -trimpath -ldflags "{{.LDFLAGS}} -s -w" -o bin/{{.BINARY}} {{.MAIN}}
- |
echo "harness size: $(du -sh bin/{{.BINARY}} | cut -f1)"
build:opt:har:
desc: Build optimized harness-har binary
dir: modules/har
cmds:
- go build -trimpath -ldflags "{{.LDFLAGS}} -s -w" -o ../../bin/harness-har ./cmd/harness-har/main-harness-har.go
- |
echo "harness-har size: $(du -sh ../../bin/harness-har | cut -f1)"
install:
desc: Build and install harness binary to ~/.local/bin
deps: [build:main]
cmds:
- mkdir -p ~/.local/bin
- cp bin/{{.BINARY}} ~/.local/bin/{{.BINARY}}
- echo "Installed ~/.local/bin/{{.BINARY}}"
dev:
desc: Run without ldflags (version shows 0.1.0-dev / dev)
cmds:
- go run {{.MAIN}} {{.CLI_ARGS}}
check:specs:
desc: Validate all *.spec.yaml files
deps: [build:main, build:har]
cmds:
- HARNESS_CHECKSPECS=1 ./bin/harness
- HARNESS_CHECKSPECS=1 ./bin/harness-har
check:specs:main:
desc: Validate core *.spec.yaml files (skips HAR build)
deps: [build:main]
cmds:
- HARNESS_CHECKSPECS=1 ./bin/harness
tidy:
desc: Tidy all modules and sync go.work
cmds:
- go mod tidy
- sh -c "cd modules/har && go mod tidy"
- go work sync
release:simple:
desc: Publish a release to GitHub (skips dirty check, no release notes)
cmds:
- goreleaser release --clean --release-notes /dev/null
clean:
desc: Remove built binaries
cmds:
- rm -rf bin/