-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTaskfile.yaml
95 lines (81 loc) · 2.44 KB
/
Taskfile.yaml
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
# https://taskfile.dev
version: '3'
dotenv: ['.env']
tasks:
build-snapshot:
desc: |
Build snapshot binaries to ./cmd/koios-rest/dist.
cmds:
- goreleaser release --snapshot --rm-dist
cover:
deps: [test]
desc: Open the cover tool
cmds:
- go tool cover -html=coverage.txt
lint:
desc: Lint the code with golangci-lint
cmds:
- golangci-lint run ./... --fix
print:next:
desc: |
Prints next version based on Conventional Commits spec.
cmds:
- svu n
release:
desc: |
To release new version in github, you must be maintainer
and have GITHUB_TOKEN env set e.g. in (.env) file
cmds:
- task: setup
- task: release:tag
# https://github.com/caarlos0/svu
release:tag:
vars:
NEXT:
sh: svu n
desc: create new tag
preconditions:
- sh: git diff-index --quiet HEAD
msg: "Commit or stash changes first"
cmds:
- git tag -sm"{{.NEXT}}" {{.NEXT}}
- git push
- git push --tags
- echo "call 'task release:pkg' to create GitHub release from tag $NEXT"
- echo "and generate/upload release packages."
release:pkg:
desc: |
Run GoReleaser either in snapshot or release mode
vars:
SNAPSHOT:
sh: 'if [[ $(git describe --exact-match HEAD) != v* ]]; then echo "--snapshot"; fi'
cmds:
- goreleaser release --clean {{.SNAPSHOT}}
setup:
desc: Setup development env.
cmds:
- go mod tidy
- go mod download
test:
desc: Run tests
env:
LC_ALL: C
vars:
TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
SOURCE_FILES: '{{default "." .SOURCE_FILES}}'
TEST_PATTERN: '{{default "." .TEST_PATTERN}}'
cmds:
- go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=5m
testdata:gen:
desc: Updates testdata in testdata directory. call (task testdata:gen endpoint_id|all)
dir: internal/testdatagen
cmds:
- go run . generate ../../testdata {{.CLI_ARGS}}
- task: testdata:unpack
testdata:unpack:
desc: Unpack testdata - useful if you want to inspect it. (task testdata:unpack endpoint_id|all)
dir: internal/testdatagen
cmds:
- go run . unpack ../../testdata/mainnet {{.CLI_ARGS}}
- go run . unpack ../../testdata/testnet {{.CLI_ARGS}}
- go run . unpack ../../testdata/guildnet {{.CLI_ARGS}}