forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
272 lines (268 loc) · 8.08 KB
/
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
name: Meshery
on:
# push:
# branches:
# - 'master'
# paths-ignore:
# - 'docs/**'
# - 'mesheryctl/**'
pull_request:
branches:
- 'master'
paths-ignore:
- 'docs/**'
- 'mesheryctl/**'
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.32
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
server-tests:
needs: [tests-ui, golangci, build-backend]
name: Server tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup Cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -tags draft ./...
build-backend:
name: Backend build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup Cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
go mod tidy
GOPROXY=direct GOSUMDB=off GO111MODULE=on go build -tags draft ./cmd/main.go
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: meshery
path: ./main
build-ui:
name: UI build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Cache node modules
id: node-cache
uses: actions/cache@v2
with:
path: |
~/cache
~/.cache
!~/cache/exclude
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/lockfiles') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
cd ui
npm i
cd ..
cd provider-ui
npm i
- name: build app
run: |
make build-ui
tests-ui:
needs: [build-ui]
name: UI integration tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Cache node modules
id: node-cache
uses: actions/cache@v2
with:
path: |
~/cache
~/.cache
!~/cache/exclude
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/lockfiles') }}
- name: Run tests
run: |
cd ui
npm i
npm run ci-test-integration
cd ..
cd provider-ui
npm i
npm test
cd ..
- name: Upload coverage to Codecov (ui)
uses: codecov/codecov-action@v1
with:
files: ./provider-ui/coverage/coverage-summary.json
directory: ./provider-ui/coverage/lcov-report
flags: integrationtests
fail_ci_if_error: true
tests-ui-e2e:
needs: [build-backend, build-ui]
name: UI end-to-end tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check out meshery-consul code
uses: actions/checkout@v2
with:
repository: layer5io/meshery-consul
path: ./meshery-consul
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: meshery
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ secrets.GO_VERSION }}
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Cache node modules
id: node-cache
uses: actions/cache@v2
with:
path: |
~/cache
~/.cache
!~/cache/exclude
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/lockfiles') }}
restore-keys: |
${{ runner.os }}-node-
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: "kind-cluster"
- name: Build Next App
run: |
cd ui
npm i
npm run build
npm run export
- name: Update /etc/hosts
run: echo "127.0.0.1 mesherylocal.layer5.io" | sudo tee -a /etc/hosts
- name: Run meshery-consul
run: |
mkdir /home/runner/.meshery
cd ./meshery-consul
go run main.go &
sleep 10
- name: Run backend
env:
PROVIDER_BASE_URLS: https://meshery.layer5.io
PORT: 9081
ADAPTER_URLS: "mesherylocal.layer5.io:10000 mesherylocal.layer5.io:10001 mesherylocal.layer5.io:10002 mesherylocal.layer5.io:10003 mesherylocal.layer5.io:10004 mesherylocal.layer5.io:10008 mesherylocal.layer5.io:10009 mesherylocal.layer5.io:10007"
run: |
chmod +x ./main
./main &
- name: Cypress run
uses: cypress-io/github-action@v2
with:
working-directory: ui
start: npm start
wait-on: http://localhost:3000
spec: cypress/integration/e2e/**/*
record: true
tag: node-${{ matrix.node }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage to Codecov (ui)
uses: codecov/codecov-action@v1
with:
files: ./ui/coverage/coverage-summary.json
directory: ./ui/coverage/lcov-report
flags: e2etests
fail_ci_if_error: true
docker-build-test:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Docker edge build & tag
if: startsWith(github.ref, 'refs/tags/') != true && success()
env:
RELEASE_CHANNEL: "edge"
run: |
DOCKER_BUILDKIT=1 docker build --no-cache -t meshery:edge-latest --build-arg TOKEN=test --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg RELEASE_CHANNEL=${RELEASE_CHANNEL} .
docker tag meshery:edge-latest meshery:edge-${GITHUB_SHA::8}
- name: Docker edge push
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
run: |
docker push ${{ secrets.IMAGE_NAME }}:edge-latest
docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::8}
- name: Docker Hub Description
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
uses: peter-evans/[email protected]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_REPOSITORY: ${{ secrets.IMAGE_NAME }}