-
Notifications
You must be signed in to change notification settings - Fork 36
/
dobi.yaml
266 lines (225 loc) · 5.31 KB
/
dobi.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#
# dobi.yaml - resources for building, testing, and developing dobi
#
meta:
project: dobi
default: all
#
# Mounts
#
mount=source:
bind: .
path: /go/src/github.com/dnephin/dobi
mount=dist:
bind: ./dist/bin/
path: /go/bin/
mount=projectdir:
bind: .
path: '{fs.projectdir}'
#
# Images
#
image=builder:
image: dobi-dev
context: dockerfiles/
dockerfile: Dockerfile.build
image=linter:
image: dobi-linter
dockerfile: dockerfiles/Dockerfile.lint
image=dist-img:
image: dnephin/dobi
tags: ["{env.DOBI_VERSION}"]
dockerfile: dockerfiles/Dockerfile.dist
annotations:
description: "Build the distribution image"
image=releaser:
image: dobi-release
context: dockerfiles/
dockerfile: Dockerfile.release
image=docs-img:
image: dobi-docs-dev
context: dockerfiles/
dockerfile: Dockerfile.docs
image=example-tester:
image: dobi-test-examples
dockerfile: Dockerfile.test-examples
context: dockerfiles/
image=circleci-alpine:
image: dnephin/circleci-alpine-step
tags: [latest]
dockerfile: Dockerfile.circleci
context: dockerfiles/ci
#
# Jobs
#
job=binary:
use: builder
artifact: ./dist/bin/
mounts: [source, dist]
command: script/build
env:
- "DOBI_BUILD_OSARCH={env.DOBI_BUILD_OSARCH:}"
annotations:
description: "Build the static binary"
tags: [binary]
job=watch:
use: builder
mounts: [source]
interactive: true
depends: [mocks]
annotations:
description: "Watch for code changes and run the unit tests"
tags: [test]
command: |
filewatcher -x vendor gotestsum -- -test.timeout 10s
env: ["GOTESTSUM_FORMAT=short-verbose"]
job=shell:
use: builder
mounts: [source, dist]
interactive: true
provide-docker: true
command: bash
annotations:
description: "Start an interactive development environment"
job=test-unit:
use: builder
mounts: [source]
depends: [mocks]
interactive: true
annotations:
tags: [test]
command: gotestsum
env: ["GOTESTSUM_FORMAT={env.GOTESTSUM_FORMAT:short}"]
job=lint:
use: linter
mounts: [source]
depends: [mocks]
annotations:
description: "Run static checks"
job=lint-shell:
use: linter
mounts: [source]
command: bash
interactive: true
job=github-release:
use: releaser
mounts: [dist]
env:
- "GITHUB_TOKEN={env.GITHUB_TOKEN}"
- "DOBI_VERSION={env.DOBI_VERSION}"
job=release-version:
use: builder
mounts: [dist]
command: "bash -ec \"dobi-linux --version | awk '{print $3}'\""
job=docs-build:
use: docs-img
artifact: ./docs/build/html.tar.gz
mounts: [source]
command: docs/script/build
depends: [binary-linux]
annotations:
tags: [docs]
job=docs-shell:
use: docs-img
mounts: [source]
interactive: true
command: bash
annotations:
tags: [docs]
job=docs-watch:
use: docs-img
mounts: [source]
interactive: true
command: docs/script/watch
annotations:
tags: [docs]
job=docs:
use: docs-img
mounts: [source]
interactive: true
ports: ["8080:8080"]
command: docs/script/serve
depends: ['docs-build']
annotations:
description: "Build docs and start an http server to preview the docs"
tags: [docs]
job=mocks:
use: builder
mounts: [source]
command: "go generate ./..."
annotations:
tags: [test]
job=deps:
use: builder
mounts: [source]
command: "go mod vendor"
sources: ['go.mod', 'go.sum']
artifact: vendor/
annotations:
description: "Install go modules"
job=test-examples:
use: example-tester
provide-docker: true
interactive: true
mounts: [projectdir, dist]
entrypoint: script/test-examples
working-dir: '{fs.projectdir}'
depends: [build-rtf, binary-linux]
env:
- 'DOCKER_API_VERSION={env.DOCKER_API_VERSION:}'
- 'COMPOSE_API_VERSION={env.DOCKER_API_VERSION:}'
- 'DOBI_NO_BIND_MOUNT={env.DOBI_NO_BIND_MOUNT:}'
- 'DOBI_EXAMPLE={env.DOBI_EXAMPLE:}'
artifact: _results/
job=examples-shell:
use: example-tester
provide-docker: true
interactive: true
mounts: [projectdir, dist]
entrypoint: sh
working-dir: '{fs.projectdir}'
job=build-rtf:
use: builder
mounts: [source, dist]
command: go get github.com/linuxkit/rtf
artifact: dist/bin/rtf
annotations:
tags: [test]
image=refactorer:
image: dnephin/go-refactor
tags: [latest]
pull: 72h
job=refactor-shell:
use: refactorer
mounts: [source]
interactive: true
working-dir: /go/src/github.com/dnephin/dobi
env: [GOPATH=/go]
command: sh
annotations:
description: "Start an interactive shell for running go refactor tools"
env=linux-only:
variables: [DOBI_BUILD_OSARCH=linux/amd64]
#
# Aliases
#
alias=test:
tasks: [test-unit, test-examples]
annotations:
description: "Run all tests"
alias=all:
tasks: [lint, test, docs-build, binary]
annotations:
description: "Run all lint and build tasks"
alias=binary-linux:
tasks: [linux-only, binary]
annotations:
tags: [binary]
alias=release:
tasks:
- 'binary'
- 'release-version:capture(DOBI_VERSION)'
- 'github-release'
- 'dist-img:push'
annotations:
tags: [release]