Taskfile.yaml
1371 bytes
1# https://taskfile.dev
2
3version: "3"
4
5tasks:
6 fmt:
7 desc: Run gofumpt and goimports
8 cmds:
9 - golangci-lint fmt
10
11 lint:
12 desc: Run base linters
13 cmds:
14 - golangci-lint run
15
16 lint:fix:
17 desc: Run linters and apply automatic fixes
18 cmds:
19 - golangci-lint run --fix
20
21 test:
22 desc: Run tests
23 cmds:
24 - go test -race ./... {{.CLI_ARGS}}
25
26 tidy:
27 desc: Run go mod tidy
28 cmds:
29 - go mod tidy
30
31 release:
32 desc: Create and push a new tag following semver
33 vars:
34 NEXT:
35 sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
36 prompt: "This will release {{.NEXT}}. Continue?"
37 preconditions:
38 - sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
39 msg: Not on main branch
40 - sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
41 msg: "Git is dirty"
42 - sh: 'gh run list --workflow build.yml --commit $(git rev-parse HEAD) --status success --json conclusion -q ".[0].conclusion" | grep -q success'
43 msg: "Test build for this commit failed or not present"
44 cmds:
45 - task: fetch-tags
46 - git commit --allow-empty -m "{{.NEXT}}"
47 - git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
48 - echo "Pushing {{.NEXT}}..."
49 - git push origin main --follow-tags
50
51 fetch-tags:
52 cmds:
53 - git fetch --tags