-
Notifications
You must be signed in to change notification settings - Fork 4
/
cloudbuild.yaml
144 lines (136 loc) · 3.75 KB
/
cloudbuild.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
tags: ['golang']
timeout: 180s
options:
env:
- 'GOMODCACHE=/var/lib/go'
- 'GOCACHE=/var/cache/go'
- 'PROJECT_ID=${PROJECT_ID}'
- 'REPO_NAME=${REPO_NAME}'
- 'GOPROXY=off'
volumes:
- name: 'GOMODCACHE'
path: '/var/lib/go'
- name: 'GOCACHE'
path: '/var/cache/go'
steps:
- name: 'gcr.io/cloud-builders/docker'
id: 'get golang'
waitFor: ['-']
entrypoint: 'bash'
args:
- -c
- |
set -ex
if ! docker tag golang:cloudbuild_cache localhost/golang:latest; then
docker pull mirror.gcr.io/library/golang:latest
docker tag {mirror.gcr.io/library,localhost}/golang:latest
fi
- name: 'localhost/golang'
id: 'gofmt'
entrypoint: 'bash'
args: ['-c', 'diff <(echo -n) <(gofmt -s -d $(find . -type f -name "*.go" -not -path "./_*"))']
- name: 'gcr.io/blitznote/golang/ineffassign'
id: 'ineffassign'
waitFor: ['gofmt']
args: ['.']
- name: 'gcr.io/blitznote/golang/golint'
id: 'lint'
waitFor: ['gofmt']
- name: 'gcr.io/blitznote/cacheutil'
id: 'restore cached var-lib-go'
waitFor: ['gofmt', 'ineffassign', 'lint']
args: ['restore', '/var/lib/go']
- name: 'gcr.io/blitznote/cacheutil'
id: 'restore cached var-cache-go'
waitFor: ['gofmt', 'ineffassign', 'lint']
args: ['restore', '/var/cache/go']
- name: 'localhost/golang'
id: 'get dependencies'
waitFor: ['gofmt', 'ineffassign', 'lint', 'restore cached var-lib-go']
env: ['GOPROXY=https://proxy.golang.org,direct']
entrypoint: 'go'
args: ['mod', 'download']
- name: 'localhost/golang'
id: 'pilot build, amd64'
waitFor: ['get dependencies', 'restore cached var-cache-go']
env: ['GOARCH=amd64']
entrypoint: 'go'
args: ['build', '.', 'errors']
- name: 'localhost/golang'
id: 'vet, amd64'
waitFor: ['pilot build, amd64']
env: ['GOARCH=amd64']
entrypoint: 'go'
args: ['vet', '.']
- name: 'localhost/golang'
id: 'test, amd64'
waitFor: ['vet, amd64']
env: ['GOARCH=amd64']
entrypoint: 'go'
args: ['test']
- name: 'localhost/golang'
id: 'pilot build, x86'
waitFor: ['get dependencies', 'restore cached var-cache-go']
env: ['GOARCH=386']
entrypoint: 'go'
args: ['build', '.', 'errors']
- name: 'localhost/golang'
id: 'vet, x86'
waitFor: ['pilot build, x86']
env: ['GOARCH=386']
entrypoint: 'go'
args: ['vet', '.']
- name: 'localhost/golang'
id: 'test, x86'
waitFor: ['vet, x86']
env: ['GOARCH=386']
entrypoint: 'go'
args: ['test']
- name: 'localhost/golang'
id: 'pilot build, purego'
waitFor: ['get dependencies', 'restore cached var-cache-go']
entrypoint: 'go'
args: ['build', '-tags', 'purego', '.', 'errors']
- name: 'localhost/golang'
id: 'vet, purego'
waitFor: ['pilot build, purego']
entrypoint: 'go'
args: ['vet', '-tags', 'purego', '.']
- name: 'localhost/golang'
id: 'test, purego'
waitFor: ['vet, purego']
entrypoint: 'go'
args: ['test', '-tags', 'purego']
# Cannot run tests for these architectures on this CI.
- name: 'localhost/golang'
id: 'pilot build, arm'
waitFor: ['get dependencies', 'restore cached var-cache-go']
env: ['GOARCH=arm']
entrypoint: 'go'
args: ['build', '.', 'errors']
- name: 'localhost/golang'
id: 'vet, arm'
waitFor: ['pilot build, arm']
env: ['GOARCH=arm']
entrypoint: 'go'
args: ['vet', '.']
- name: 'localhost/golang'
id: 'pilot build, mips'
waitFor: ['get dependencies', 'restore cached var-cache-go']
env: ['GOARCH=mips']
entrypoint: 'go'
args: ['build', '.', 'errors']
- name: 'localhost/golang'
id: 'vet, mips'
waitFor: ['pilot build, mips']
env: ['GOARCH=mips']
entrypoint: 'go'
args: ['vet', '.']
# fin
- name: 'gcr.io/blitznote/cacheutil'
id: 'stash cached var-cache-go'
args: ['stash', '/var/cache/go']
- name: 'gcr.io/blitznote/cacheutil'
id: 'stash cached var-lib-go'
waitFor: ['get dependencies']
args: ['stash', '/var/lib/go']