-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
74 lines (62 loc) · 1.86 KB
/
Taskfile.yml
File metadata and controls
74 lines (62 loc) · 1.86 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
---
version: "3.40"
vars:
SOURCES:
sh: find . -name "*.go" -type f -not -iname mock.go -not -path "./.devenv/*" -not -path "./.direnv/*" | xargs echo
PACKAGES:
sh: go list ./... | xargs echo
tasks:
clean:
desc: Remove all temporary build artifacts
cmds:
- go clean -i ./...
- rm -rf bin/ dist/
generate:
desc: Generate code
cmds:
- go generate {{ .PACKAGES }}
fmt:
desc: Run standard formatter
cmds:
- gofmt -s -w {{ .SOURCES }}
vet:
desc: Run vet linting
cmds:
- go vet {{ .PACKAGES }}
lint:
desc: Run revive linting
cmds:
- for PKG in {{ .PACKAGES }}; do go tool github.com/mgechev/revive -config revive.toml -set_exit_status $PKG || exit 1; done;
golangci:
desc: Run golangci linter
cmds:
- go tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint run ./...
test:
desc: Run tests
cmds:
- go test -coverprofile coverage.out {{ .PACKAGES }}
build:
desc: Build all required binary artifacts
cmds:
- go build -v
-tags 'netgo'
-ldflags '-s -w -extldflags "-static" -X "{{ .IMPORT }}/pkg/version.String={{ .VERSION }}" -X "{{ .IMPORT }}/pkg/version.Revision={{ .REVISION }}" -X "{{ .IMPORT }}/pkg/version.Date={{ now | date "20060102" }}"'
-o bin/mygithub{{if eq OS "windows"}}.exe{{end}}
./cmd/mygithub
env:
CGO_ENABLED: "0"
vars:
IMPORT: github.com/webhippie/mygithub
VERSION:
sh: if [[ -z "${CI_COMMIT_TAG}" ]]; then git rev-parse --short HEAD; else echo "${CI_COMMIT_TAG#v}"; fi
REVISION:
sh: git rev-parse --short HEAD
build:release:
desc: Generate a release with goreleaser
cmds:
- goreleaser release --clean
build:snapshot:
desc: Generate a snapshot with goreleaser
cmds:
- goreleaser release --clean --snapshot
...