-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
104 lines (94 loc) · 3.16 KB
/
Copy pathTaskfile.yml
File metadata and controls
104 lines (94 loc) · 3.16 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
# SPDX-License-Identifier: EUPL-1.2
#
# The repo's task verbs. go-task resolves Taskfile.yml before Taskfile.yaml,
# so there is deliberately only one file here — a second one is invisible.
#
# build the binary, at bin/core-agent
# build:lthn the same binary under its crew alias, bin/lthn-agent
# test / vet / check the Go gates, as CI runs them (GOWORK=off)
# cov coverage, at the path codecov + SonarCloud read
# module-graph:refresh regenerate module-graph.json after dappco.re/go/* bumps
#
# Everything Go runs with GOWORK=off: the module must build from go.mod alone,
# because that is what CI does and what a consumer gets. There is no external/
# checkout to fall back on.
version: '3'
env:
GOWORK: 'off'
tasks:
default:
desc: "List the available tasks"
cmds:
- task --list
silent: true
build:
desc: "Build core-agent to bin/core-agent"
dir: go
cmds:
- mkdir -p ../bin
- go build -trimpath -o ../bin/core-agent ./cmd/core-agent/
- ../bin/core-agent version
- echo " core-agent → bin/core-agent"
build:lthn:
desc: "Build the same binary as bin/lthn-agent — the crew alias lthn/desktop's pre-build stages (mirrors go-mlx's build:lthn → bin/lthn-mlx)"
dir: go
cmds:
- mkdir -p ../bin
- go build -trimpath -o ../bin/lthn-agent ./cmd/core-agent/
- echo " lthn-agent → bin/lthn-agent"
test:
desc: "Run the Go suite the way CI does"
dir: go
cmds:
- go test ./... -count=1 -timeout 900s
vet:
desc: "go vet the module"
dir: go
cmds:
- go vet ./...
cov:
desc: "Module coverage — writes go/coverage.out (the path codecov + SonarCloud read) and prints the total. `task cov` then open go/coverage.out, or pipe to `go tool cover -html`."
dir: go
cmds:
- go test -coverprofile=coverage.out -covermode=atomic ./...
- go tool cover -func=coverage.out | tail -1
cov:html:
desc: "Coverage as a browsable HTML report (runs cov first)"
dir: go
deps: [cov]
cmds:
- go tool cover -html=coverage.out -o coverage.html
- echo " → go/coverage.html"
check:
desc: "Everything CI gates on: build, vet, test"
cmds:
- task: build
- task: vet
- task: test
module-graph:refresh:
desc: Regenerate module-graph.json from go/go.mod (run after dappco.re/go/* dep bumps)
cmds:
- |
TODAY="$(date +%Y-%m-%d)" awk '
BEGIN {
print "{"
print " \"module\": \"dappco.re/go/agent\","
printf " \"generated_at\": \"%s\",\n", ENVIRON["TODAY"]
print " \"source\": \"go/go.mod\","
print " \"dependencies\": {"
}
/^[[:space:]]+dappco\.re\// {
mod=$1; ver=$2
entries[++n]=sprintf(" \"%s\": \"%s\"", mod, ver)
}
END {
for (i=1; i<=n; i++) {
sep=(i<n)?",":""
print entries[i] sep
}
print " }"
print "}"
}
' go/go.mod > module-graph.json
- jq . module-graph.json > /dev/null
- echo "module-graph.json refreshed"