-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
82 lines (69 loc) · 2.3 KB
/
Copy pathTaskfile.yml
File metadata and controls
82 lines (69 loc) · 2.3 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
version: '3'
dotenv: ['.env']
tasks:
build:
desc: Build the meshstack binary
cmds:
- go build {{.CLI_ARGS}} ./cmd/meshstack
install:
desc: Install the meshstack binary into GOBIN
cmds:
- go install {{.CLI_ARGS}} ./cmd/meshstack
test:
desc: Run unit tests
cmds:
- go test ./... {{.CLI_ARGS}}
lint:
# Also formats, so there is no separate fmt task: golangci-lint's formatters use the
# go/format compiled into it, and a gofmt built against another Go release enforces
# different formatting. `go tool` builds it from the pin in go.mod, against the same Go.
desc: Run golangci-lint
cmds:
- go tool golangci-lint run {{.CLI_ARGS}}
vuln:
desc: Check for known vulnerabilities with govulncheck
cmds:
- go tool govulncheck {{.CLI_ARGS}} ./...
tidy:
desc: Tidy go.mod and go.sum
cmds:
- go mod tidy
nix:vendor-hash:
# An empty vendorHash makes nix build the Go modules anyway and report the hash it got. The
# `-i.bak` keeps sed portable between GNU and BSD.
desc: Set vendorHash in flake.nix to match go.sum
cmds:
- |
set_vendor_hash() { sed -i.bak "s|vendorHash = \"[^\"]*\";|vendorHash = \"$1\";|" flake.nix && rm flake.nix.bak; }
old=$(sed -n 's|^ *vendorHash = "\([^"]*\)";|\1|p' flake.nix)
set_vendor_hash ""
new=$(nix build .#meshstack.goModules --no-link 2>&1 | sed -n 's|^ *got: *||p')
if [ -z "$new" ]; then
set_vendor_hash "$old"
echo "nix reported no hash; run 'nix build .#meshstack.goModules' to see why" >&2
exit 1
fi
set_vendor_hash "$new"
echo "vendorHash = \"$new\""
release:check:
desc: Validate .goreleaser.yml
cmds:
- goreleaser check
release:snapshot:
desc: Build the release artifacts into dist/ without publishing them
cmds:
- goreleaser release --snapshot --clean {{.CLI_ARGS}}
image:
desc: Build the container image locally
cmds:
- docker build -t meshstack:dev {{.CLI_ARGS}} .
docs:demo:
desc: Record docs/demo.gif and docs/profile.gif with VHS, see docs/demo/README.md
cmds:
- vhs docs/demo/demo.tape
- vhs docs/demo/profile.tape
clean:
desc: Remove build artifacts
cmds:
- rm -f meshstack
- rm -rf dist