-
Notifications
You must be signed in to change notification settings - Fork 173
333 lines (317 loc) · 10.2 KB
/
layotto-ci.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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
name: Layotto Dev Pipeline 🌊
# Ignore some changes of commits:
# 1. changes in .ci/
# 2. changes in docs/
# 3. changes in markdown files
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
branches: "*"
paths-ignore:
- 'docs/**'
- '**/*.md'
jobs:
style-check:
name: "Go Style Check"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Format Go
run: |
make workspace
resolve-modules:
name: "Resolve Go Modules"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- id: set-matrix
run: sh ./etc/script/resolve-modules.sh
golangci-lint:
name: "Go CI Linter"
needs: [style-check,resolve-modules]
runs-on: ubuntu-20.04
strategy:
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.5
- name: Go Lint Test
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
working-directory: ${{ matrix.workdir }}
args: "--out-${NO_FUTURE}format colored-line-number"
go-unit-test:
name: "Go Unit Test"
needs: [style-check]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.1
- name: Go Unit Test
run: make test
coverage:
name: "Coverage Analysis"
needs: [go-unit-test,golangci-lint,style-check]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Test Coverage
run: make coverage
- name: Post Coverage
run: bash <(curl -s https://codecov.io/bash)
wasm-integrate:
name: "Integrate with WASM"
needs: [coverage]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Run Integrate tests
run: make integrate-wasm
runtime-integrate:
name: "Integrate with Runtime"
needs: [coverage]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Run Integrate tests
run: make integrate-runtime
build-binary-darwin-amd64-artifact:
name: "Darwin AMD64 Artifact"
needs: [runtime-integrate,wasm-integrate]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Build Artifact
run: |
make go.build.darwin_amd64.layotto
- name: Publish Artifact
uses: actions/[email protected]
with:
name: layotto.darwin_amd64
path: _output/darwin/amd64/layotto
retention-days: 5
if-no-files-found: error
build-binary-darwin-arm64-artifact:
name: "Darwin ARM64 Artifact"
needs: [runtime-integrate,wasm-integrate]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Build Artifact
run: |
make go.build.darwin_arm64.layotto
- name: Publish Artifact
uses: actions/[email protected]
with:
name: layotto.darwin_arm64
path: _output/darwin/arm64/layotto
retention-days: 5
if-no-files-found: error
build-binary-linux-amd64-artifact:
name: "Linux AMD64 Artifact"
needs: [runtime-integrate,wasm-integrate]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Build Artifact
run: |
make go.build.linux_amd64.layotto
- name: Publish Artifact
uses: actions/[email protected]
with:
name: layotto.linux_amd64
path: _output/linux/amd64/layotto
retention-days: 5
if-no-files-found: error
build-binary-linux-arm64-artifact:
name: "Linux ARM64 Artifact"
needs: [runtime-integrate,wasm-integrate]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
- name: Build Artifact
run: |
make go.build.linux_arm64.layotto
- name: Publish Artifact
uses: actions/[email protected]
with:
name: layotto.linux_arm64
path: _output/linux/arm64/layotto
retention-days: 5
if-no-files-found: error
build-wasm-binary-linux-amd64-artifact:
name: "Linux AMD64 WASM Artifact"
needs: [wasm-integrate]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code
uses: actions/checkout@v2
# TODO(@Xunzhuo): open it after stabilizing wasm cmds
# - name: Build Artifact
# run: |
# make wasm
# - name: Publish Artifact
# uses: actions/[email protected]
# with:
# name: layotto.wasm.linux_amd64
# path: _output/linux/amd64/layotto
# retention-days: 5
# if-no-files-found: error
build-push-wasm-image:
name: "Linux AMD64 WASM Image"
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact]
if: github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# TODO(@Xunzhuo): open it after stabilizing wasm cmds
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build Layotto Latest Image
# run: |
# make wasm.image VERSION=latest
# - name: Push Image to DockerHub
# run: |
# make wasm.image.push VERSION=latest
build-push-linux-amd64-image:
name: "Linux AMD64 Image"
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact]
if: github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Layotto Latest Image
run: |
make image.build.linux_amd64.layotto VERSION=latest
- name: Push Image to DockerHub
run: |
make image.push.linux_amd64.layotto VERSION=latest
- name: Build layotto/layotto_injector:latest Image
run: |
make image.build.linux_amd64.layotto_injector VERSION=latest
- name: Push layotto/layotto_injector:latest Image to DockerHub
run: |
make image.push.linux_amd64.layotto_injector VERSION=latest
- name: Build layotto/proxyv2:latest Image
run: |
make image.proxyv2.build VERSION=latest
- name: Push layotto/proxyv2:latest Image to DockerHub
run: |
make image.proxyv2.push VERSION=latest
build-push-linux-arm64-image:
name: "Linux ARM64 Image"
needs: [build-wasm-binary-linux-amd64-artifact,build-binary-linux-arm64-artifact,build-binary-linux-amd64-artifact,build-binary-darwin-amd64-artifact,build-binary-darwin-arm64-artifact]
if: github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Layotto Latest Image
run: |
make image.build.linux_arm64.layotto VERSION=latest
- name: Push Image to DockerHub
run: |
make image.push.linux_arm64.layotto VERSION=latest
- name: Build layotto/layotto_injector:latest Image
run: |
make image.build.linux_arm64.layotto_injector VERSION=latest
- name: Push layotto/layotto_injector:latest Image to DockerHub
run: |
make image.push.linux_arm64.layotto_injector VERSION=latest
package-push-injector-helm-chart:
name: "Layotto Injector Helm Chart"
if: github.ref_name == 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Package and Push Layotto Injector Latest Helm Chart
run: |
CHART_VERSION=v0.0.0-latest APP_VERSION=latest make helm-package
CHART_VERSION=v0.0.0-latest APP_VERSION=latest make helm-push