-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathTaskfile.yml
185 lines (165 loc) · 5.74 KB
/
Taskfile.yml
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
version: '3'
tasks:
#
# Tests
#
test:core:gnomock:
env:
GOMAXPROCS: 2
cmds:
- go test -race -cover -coverprofile=gnomock-cover.txt -coverpkg=./... -v .
test:core:gnomockd:
env:
GOMAXPROCS: 2
cmds:
- go test -race -cover -coverprofile=gnomockd-cover.txt -coverpkg=./... -v ./internal/gnomockd -run TestGnomockd
test:core:internal:
env:
GOMAXPROCS: 2
cmds:
- |
go test -race -cover -coverprofile=internal-cover.txt -v -coverpkg=./... \
./internal/errors \
./internal/registry \
./internal/cleaner \
./internal/health
swagger:update-version:
cmds:
- |
sed -Ei '' 's/^ version: (.*)$/ version: {{.version}}/' swagger/swagger.yaml
- |
sed -Ei '' 's/apis\/orlangure\/gnomock\/(.*)#/apis\/orlangure\/gnomock\/{{.version}}#/' README.md
- git add swagger/swagger.yaml
- git commit -m 'Update version to {{.version}}'
silent: true
dir: .
vars:
CURRENT_BRANCH:
sh: git branch --show-current
preconditions:
- sh: test $version
msg: version is not set
- sh: test "{{.CURRENT_BRANCH}}" != "master"
msg: version changes cannot happen on master branch
- sh: test $release
msg: release flag is not set
gnomock:run:
cmds:
- task: gnomock:stop
- task: gnomock:build:server
- task: gnomock:build:cleaner
- |
docker run -itd --rm \
-p 23042:23042 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $PWD:$PWD \
--name gnomockd_test \
orlangure/gnomock
dir: .
gnomock:stop:
cmds:
- docker container stop gnomockd_test || true
gnomock:build:server:
env:
DOCKER_BUILDKIT: "1"
cmds:
- task: gnomock:build:server:amd64
- task: gnomock:build:server:arm64
dir: .
gnomock:build:server:amd64:
env:
DOCKER_BUILDKIT: "1"
cmds:
- docker build --build-arg GOARCH=amd64 --platform linux/amd64 --progress plain --tag orlangure/gnomock:amd64 .
status:
- test -z $release
- test {{ eq ARCH "amd64" }} == false
dir: .
gnomock:build:server:arm64:
env:
DOCKER_BUILDKIT: "1"
cmds:
- docker build --build-arg GOARCH=arm64 --platform linux/arm64 --progress plain --tag orlangure/gnomock:arm64 .
status:
- test -z $release
- test {{ eq ARCH "arm64" }} == false
dir: .
gnomock:build:cleaner:
env:
DOCKER_BUILDKIT: "1"
cmds:
- task: gnomock:build:cleaner:amd64
- task: gnomock:build:cleaner:arm64
dir: ./cmd/cleaner
gnomock:build:cleaner:amd64:
env:
DOCKER_BUILDKIT: "1"
cmds:
- docker build --build-arg GOARCH=amd64 --platform linux/amd64 --progress plain --tag orlangure/gnomock-cleaner:amd64 .
status:
- test -z $release
- test {{ eq ARCH "amd64" }} == false
dir: ./cmd/cleaner
gnomock:build:cleaner:arm64:
env:
DOCKER_BUILDKIT: "1"
cmds:
- docker build --build-arg GOARCH=arm64 --platform linux/arm64 --progress plain --tag orlangure/gnomock-cleaner:arm64 .
status:
- test -z $release
- test {{ eq ARCH "arm64" }} == false
dir: ./cmd/cleaner
# to release, set env `release` to true
gnomock:upload:cleaner:
vars:
CURRENT_BRANCH:
sh: git branch --show-current
cmds:
- task: gnomock:build:cleaner
# latest manifest
- docker push orlangure/gnomock-cleaner:amd64
- docker push orlangure/gnomock-cleaner:arm64
- docker manifest create --amend orlangure/gnomock-cleaner:latest orlangure/gnomock-cleaner:amd64 orlangure/gnomock-cleaner:arm64
- docker manifest push orlangure/gnomock-cleaner:latest
# version manifest
- docker tag orlangure/gnomock-cleaner:amd64 orlangure/gnomock-cleaner:{{.version}}-amd64
- docker tag orlangure/gnomock-cleaner:arm64 orlangure/gnomock-cleaner:{{.version}}-arm64
- docker push orlangure/gnomock-cleaner:{{.version}}-amd64
- docker push orlangure/gnomock-cleaner:{{.version}}-arm64
- docker manifest create --amend orlangure/gnomock-cleaner:{{.version}} orlangure/gnomock-cleaner:{{.version}}-amd64 orlangure/gnomock-cleaner:{{.version}}-arm64
- docker manifest push orlangure/gnomock-cleaner:{{.version}}
preconditions:
- sh: test $version
msg: version is not set
- sh: test "{{.CURRENT_BRANCH}}" == "master"
msg: docker images must be built on master
# to release, set env `release` to true
gnomock:upload:server:
vars:
CURRENT_BRANCH:
sh: git branch --show-current
cmds:
- task: gnomock:build:server
# latest manifest
- docker push orlangure/gnomock:arm64
- docker push orlangure/gnomock:amd64
- docker manifest create --amend orlangure/gnomock:latest orlangure/gnomock:amd64 orlangure/gnomock:arm64
- docker manifest push orlangure/gnomock:latest
# version manifest
- docker tag orlangure/gnomock:amd64 orlangure/gnomock:{{.version}}-amd64
- docker tag orlangure/gnomock:arm64 orlangure/gnomock:{{.version}}-arm64
- docker push orlangure/gnomock:{{.version}}-amd64
- docker push orlangure/gnomock:{{.version}}-arm64
- docker manifest create --amend orlangure/gnomock:{{.version}} orlangure/gnomock:{{.version}}-amd64 orlangure/gnomock:{{.version}}-arm64
- docker manifest push orlangure/gnomock:{{.version}}
preconditions:
- sh: test $version
msg: version is not set
- sh: test "{{.CURRENT_BRANCH}}" == "master"
msg: docker images must be built on master
- sh: test $release
msg: release flag is not set
release:gnomock:docker:
cmds:
- task: gnomock:upload:cleaner
- task: gnomock:upload:server