forked from jbeda/mdreflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
97 lines (85 loc) · 3.79 KB
/
Copy pathTaskfile.yaml
File metadata and controls
97 lines (85 loc) · 3.79 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
# Common procedures as code (https://taskfile.dev). Anything mechanical
# lives here rather than in prompts or muscle memory: `task --list`.
version: "3"
vars:
FUZZTIME: '{{ .FUZZTIME | default "300s" }}'
# Stamp local builds so --version says exactly what you're running
# (e.g. v0.1.1-2-gb22590b-dirty). goreleaser stamps releases with the
# tag instead; a plain `go build` leaves the dev/none/unknown defaults.
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo dev
COMMIT:
sh: git rev-parse --short HEAD 2>/dev/null || echo none
DATE:
sh: date +%Y-%m-%dT%H:%M:%S%z
LDFLAGS: "-X main.version={{ .VERSION }} -X main.commit={{ .COMMIT }} -X main.date={{ .DATE }}"
tasks:
default:
deps: [verify]
build:
desc: "Build ./bin/mdreflow for local use, version-stamped from git describe"
cmds:
- go build -ldflags "{{ .LDFLAGS }}" -o bin/mdreflow ./cmd/mdreflow
install:
desc: "go install mdreflow into GOBIN, version-stamped from git describe"
cmds:
- go install -ldflags "{{ .LDFLAGS }}" ./cmd/mdreflow
verify:
desc: "Full verification chain: build, vet, gofmt, lint, tests"
cmds:
- go build ./...
- go vet ./...
- test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
- golangci-lint run
- go test ./... -count=1
fuzz:
desc: "Foreground fuzz soak (FUZZTIME=300s default); required after any reflow-logic change"
cmds:
- go test -fuzz=FuzzFormat -fuzztime={{ .FUZZTIME }} .
vulncheck:
desc: "Run govulncheck locally (also runs weekly + on tags in CI)"
cmds:
- go run golang.org/x/vuln/cmd/govulncheck@latest ./...
dogfood:
desc: "Format the repo's own Markdown with mdreflow"
cmds:
- go run ./cmd/mdreflow .
dogfood-check:
desc: "Check the repo's own Markdown is formatted (CI-style, exit 1 if not)"
cmds:
- go run ./cmd/mdreflow --check .
release-prep:
desc: "Bump version references in the README (pre-commit rev) to VERSION"
requires:
vars: [VERSION]
cmds:
- "sed -i -E 's|rev: v[0-9]+\\.[0-9]+\\.[0-9]+|rev: {{ .VERSION }}|' README.md"
- "grep -q 'rev: {{ .VERSION }}' README.md"
- 'echo "README pre-commit rev -> {{ .VERSION }}; commit alongside the CHANGELOG retitle"'
release-notes:
desc: "Print the GitHub release notes for VERSION (extracted from CHANGELOG.md)"
requires:
vars: [VERSION]
cmds:
- scripts/release-notes.sh {{ .VERSION }}
release-verify:
desc: "Download VERSION's linux/amd64 release asset, verify checksum, smoke-test the binary"
requires:
vars: [VERSION]
vars:
TMP:
sh: mktemp -d
cmds:
- defer: rm -rf {{ .TMP }}
- gh release download {{ .VERSION }} -R jbeda/mdreflow -D {{ .TMP }} -p 'mdreflow_*_linux_amd64.tar.gz' -p checksums.txt
- cd {{ .TMP }} && grep linux_amd64 checksums.txt | sha256sum -c -
- cd {{ .TMP }} && tar xzf mdreflow_*_linux_amd64.tar.gz mdreflow
- '{{ .TMP }}/mdreflow --version'
- printf 'Two sentences here. Split please.\n' | {{ .TMP }}/mdreflow | diff - <(printf 'Two sentences here.\nSplit please.\n')
# Pull the version through the public module proxy (makes it visible
# to `go install @latest`) and ask pkg.go.dev to index it. The final
# page check is soft: indexing can lag by minutes.
- "curl -sf -o /dev/null https://proxy.golang.org/github.com/jbeda/mdreflow/@v/{{ .VERSION }}.info"
- "curl -sf -X POST -o /dev/null https://pkg.go.dev/fetch/github.com/jbeda/mdreflow@{{ .VERSION }}"
- "curl -sf -o /dev/null https://pkg.go.dev/github.com/jbeda/mdreflow@{{ .VERSION }} && echo 'pkg.go.dev indexed {{ .VERSION }}' || echo 'pkg.go.dev not showing {{ .VERSION }} yet (indexing lags; re-check in a few minutes)'"
- echo "release {{ .VERSION }} verified"