-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
100 lines (85 loc) · 2.23 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
96
97
98
99
100
version: '3'
vars:
BIN_NAME: docker-runx
PKG_NAME: github.com/eunomie/docker-runx
BIN_PLATFORMS: linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64,windows/arm64
GOLANGCI_LINT_IMAGE_NAME: docker/golangci-lint:1.61.0-go1.23.1
tasks:
go:test:
cmds:
- go test -race -coverpkg=./... -coverprofile=.coverage -shuffle=on ./...
go:cover:
cmds:
- go tool cover -html=.coverage
go:tidy:
cmds:
- go mod tidy -v
go:checkmodules:
cmds:
- go mod verify
- go mod download
go:build:
cmds:
- task: go:bin
- task: docker:scout:fs
go:bin:
cmds:
- |
docker buildx build \
--build-arg BIN_NAME={{.BIN_NAME}} \
--build-arg NO_ARCHIVE=true \
-f Dockerfile \
--platform local \
--target export-bin \
-o type=local,dest=dist,platform-split=false \
.
go:bin:all:
cmds:
- |
docker buildx build \
--build-arg BIN_NAME={{.BIN_NAME}} \
-f Dockerfile \
--platform {{.BIN_PLATFORMS}} \
--target export-bin \
-o type=local,dest=dist,platform-split=false \
.
go:fmt:
cmds:
- find . -type f -name "*.go" -exec .github/remove_empty_imports.sh "{}" \;
- goimports -w -local github.com/docker,github.com/eunomie .
- gofumpt -w .
go:lint:
cmds:
- |
docker run --rm \
-v $(pwd):/app \
-v $(go env GOPATH)/pkg:/go/pkg \
-v $(go env GOCACHE):/cache/go \
-e GOFLAGS=-buildvcs=false \
-e GOCACHE=/cache/go \
-e GOLANGCI_LINT_CACHE=/cache/go \
-w /app \
{{.GOLANGCI_LINT_IMAGE_NAME}} \
golangci-lint run -v --timeout 5m
go:gendocs:
cmds:
- go run ./cmd/gen-docs --formats md,yaml
docker:scout:fs:
env:
DOCKER_CLI_HINTS: false
cmds:
- docker scout cves --format only-packages --only-vuln-packages fs://.
ci:install:
cmds:
- go install golang.org/x/tools/cmd/goimports@latest
- go install mvdan.cc/gofumpt@latest
precommit:
deps:
- go:checkmodules
- go:fmt
- go:lint
- go:test
- go:gendocs
clean:
cmds:
- rm -rf dist