-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTaskfile.yml
More file actions
98 lines (89 loc) · 2.74 KB
/
Copy pathTaskfile.yml
File metadata and controls
98 lines (89 loc) · 2.74 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
version: '3'
tasks:
gen:
desc: "Generate protobuf Go types"
preconditions:
- sh: which protoc
msg: "`protoc` not found. Install from https://grpc.io/docs/protoc-installation/"
- sh: which protoc-gen-go
msg: "`protoc-gen-go` not found. Install via: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest"
sources:
- s2-specs/**/*.proto
generates:
- generated/**/*.go
cmds:
- mkdir -p generated
- cmd: |
protoc --go_out=generated \
--go_opt=paths=import \
--go_opt=Ms2-specs/s2/v1/s2.proto=. \
s2-specs/s2/v1/s2.proto
test:
deps: [gen]
cmds:
- go test ./...
test:integration:
desc: "Run integration tests"
deps: [gen]
cmds:
- go test -v -timeout 10m -count=1 -run 'Test(List|Create|Get|Delete|Reconfigure)(Basin|Stream)|TestLocations|Test(CheckTail|Append|Read|Fence|Trim|Client|AppendSession|ReadSession)|Test(Account|Basin|Stream)Metrics' ./s2
lint:
deps: [gen]
cmds:
- |
if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not installed; skip lint" >&2; \
fi
eg:
desc: "Run an example. Usage: task eg NAME=readsession"
requires:
vars: [NAME]
cmds:
- task: eg:build
vars: { NAME: '{{.NAME}}' }
- .out/examples/{{.NAME}} {{.CLI_ARGS}}
eg:build:
deps: [gen]
requires:
vars: [NAME]
cmds:
- mkdir -p .out/examples
- go build -o .out/examples/{{.NAME}} ./examples/{{.NAME}}
lint:gen:
deps: [gen]
cmds:
- |
# Ignore version comment lines (protoc-gen-go and protoc versions)
git diff generated/*.go | grep -v '^[-+]//.*protoc' | grep -q '^[-+]' && {
echo "Generated code has changed (ignoring version comments)"
echo "Run 'task gen' and commit the generated code"
exit 1
} || echo "Up-to-date"
release:prepare:
requires:
vars: [VERSION]
vars:
SEMVER:
sh: ./scripts/semver.sh {{.VERSION}}
BRANCH: 'release-{{.SEMVER}}-{{now | unixEpoch}}'
cmds:
- git fetch origin -t
- git checkout origin/main
- git switch -c {{.BRANCH}}
- git cliff -o CHANGELOG.md --tag {{.SEMVER}}
- git add CHANGELOG.md
- 'git commit -m "chore(release): {{.SEMVER}}"'
- echo "Push the branch '{{.BRANCH}}'. Once merged, tag the release using 'task release:tag'"
release:tag:
requires:
vars: [VERSION]
vars:
SEMVER:
sh: ./scripts/semver.sh {{.VERSION}}
cmds:
- git fetch origin -t
- git checkout origin/main
- git tag {{.SEMVER}}
- echo "Push the tag '{{.SEMVER}}' to release"