Repository navigation
Expand file tree
/
Copy pathTaskfile.dist.yml
More file actions
131 lines (113 loc) · 3.46 KB
/
Copy pathTaskfile.dist.yml
File metadata and controls
131 lines (113 loc) · 3.46 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# https://taskfile.dev
version: "3"
includes:
md: ./taskfiles/Taskfile.md.yml
lint:
taskfile: ./taskfiles/Taskfile.lint.yml
flatten: true
silent: true
vars:
# The leading v is stripped to match goreleaser's {{ .Version }}. The fallback
# is captured before the strip, so an undescribable tree yields "dev" rather
# than an empty string.
SPECSDEPLOYD_VERSION:
sh: described=$(git describe --tags --always --dirty="-dev" 2>/dev/null || echo "dev"); echo "${described#v}"
tasks:
dc:
desc: Run a docker compose command
internal: true
vars:
FIXUID:
sh: echo ${FIXUID:-$(id -u)}
FIXGID:
sh: echo ${FIXGID:-$(id -g)}
cmds:
- FIXUID={{ .FIXUID }} FIXGID={{ .FIXGID }} docker compose {{ .SUB_CMD }} {{ .CLI_ARGS }}
dc:build:
desc: Run docker compose build
cmds:
- task: dc
vars:
SUB_CMD: --profile=* build
dc:run:*:
desc: Run a one-off docker compose command
vars:
SERVICE: '{{ index .MATCH 0 }}'
RUN_FLAGS: '{{ .RUN_FLAGS | default "" }}'
USER_FLAG: '{{ (ne (.NON_ROOT | default "true") "false") | ternary " --user $(id -u):$(id -g)" "" }}'
COMPOSE_SERVICES:
sh: COMPOSE_PROFILES="*" docker compose config --services
cmds:
- task: dc
vars:
SUB_CMD: 'run --rm {{ .RUN_FLAGS }} {{ .USER_FLAG }} {{ .SERVICE }} {{ .SUB_CMD }}'
CLI_ARGS: '{{ .CLI_ARGS }}'
requires:
vars:
- name: SERVICE
enum:
ref: .COMPOSE_SERVICES | splitLines | compact
dc:shell:
desc: Shell into a docker compose service
cmds:
- task: dc
vars:
SUB_CMD: "run --tty --rm go-builder /bin/bash"
CLI_ARGS: "{{.CLI_ARGS}}"
build:
desc: Build specsdeployd into the working directory
cmds:
- task: lint
- >-
docker buildx bake --file compose.yml
--set "go-binary.output=type=local,dest=."
--set "go-binary.args.GOARCH={{ARCH}}"
--set "go-binary.args.GOOS={{OS}}"
--set "go-binary.args.SPECSDEPLOYD_VERSION={{.SPECSDEPLOYD_VERSION}}"
go-binary
tidy:check:
desc: Check that go.mod and go.sum are tidy
summary: |
Fails, without writing anything, when `go mod tidy` would change go.mod or go.sum.
Run `task tidy` to apply what it reports.
cmds:
- task: dc:run:go-builder
vars:
SUB_CMD: "go mod tidy -diff"
tidy:
desc: Run go mod tidy
cmds:
- task: dc:run:go-builder
vars:
SUB_CMD: "go mod tidy"
test:
desc: Run go tests
cmds:
- task: dc:run:go-builder
vars:
SUB_CMD: "go test -race -tags=integration ./..."
checkall:
desc: Run every check — the tidy check, golangci-lint, the Go tests, and markdownlint
summary: |
The full local check sequence: tidy:check, lint, test, md:check.
Every step reports; none of them writes. Run this before opening a pull request.
cmds:
- task: tidy:check
- task: lint
- task: test
- task: md:check
release:dry-run:
desc: Build a snapshot release locally without publishing
cmds:
- task: dc:run:goreleaser
vars:
SUB_CMD: release --snapshot --clean
cleanup:
desc: Cleanup workspace
summary: |
Cleanup of almost all gitignored files, untracked files and development containers.
The following files/dirs are excluded: none
cmds:
- git clean
-xd
--force