generated from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 7
292 lines (289 loc) · 9.84 KB
/
build-ui-and-server.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
name: Meshery UI and Server
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- "master"
paths-ignore:
- "docs/**"
- "mesheryctl/**"
- "*.md"
- "*.github/**"
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
permissions: read-all
jobs:
build-backend:
name: Backend build
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: Build Meshery Server
env:
PROVIDER_BASE_URLS: http://localhost:9876
PORT: 9081
ADAPTER_URLS: "localhost:10000 localhost:10001 localhost:10002 localhost:10003 localhost:10004 localhost:10009 localhost:10007 localhost:10013"
run: |
make build-server
ui-build:
name: UI build
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache node modules
id: node-cache
uses: actions/cache@v4
with:
path: |
~/cache
~/.cache
/home/runner/.cache
!~/cache/exclude
**/node_modules
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: |
cd ui
npm i
cd ..
cd provider-ui
npm i
# - name: Cache meshery-ui
# id: meshery-ui-cache
# uses: actions/cache@v3
# with:
# path: |
# /home/runner/work/meshery/meshery/ui/out
# key: ${{ runner.os }}-meshery-ui-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
- name: build meshery-ui
# if: steps.meshery-ui-cache.outputs.cache-hit != 'true'
run: |
make ui-meshery-build
- name: build provider-ui
run: |
make ui-provider-build
- name: Upload meshery-ui artifacts
uses: actions/upload-artifact@v4
with:
name: meshery-ui
retention-days: 30
path: /home/runner/work/meshery/meshery/ui/out
- name: Upload provider-ui artifacts
uses: actions/upload-artifact@v4
with:
name: provider-ui
retention-days: 30
path: /home/runner/work/meshery/meshery/provider-ui/out
tests-ui-e2e:
needs: [build-backend, ui-build]
name: UI end-to-end tests
environment: staging-playground
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check out meshery-istio code
uses: actions/checkout@v4
with:
repository: layer5io/meshery-istio
path: ./meshery-istio
# - name: Check out meshery-consul code
# uses: actions/checkout@v4
# with:
# repository: layer5io/meshery-consul
# path: ./meshery-consul
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: "kind-cluster"
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: Run meshery-istio
run: |
mkdir -p /home/runner/.meshery/bin
cd ./meshery-istio
go run main.go &
sleep 60
# - name: Run meshery-consul
# run: |
# mkdir -p /home/runner/.meshery/bin
# cd ./meshery-consul
# go run main.go &
# sleep 60
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Restore node modules cache
id: node-cache
uses: actions/cache@v4
with:
path: |
~/cache
~/.cache
/home/runner/.cache
!~/cache/exclude
**/node_modules
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Download meshery-ui artifacts
uses: actions/download-artifact@v4
with:
name: meshery-ui
path: /home/runner/work/meshery/meshery/ui/out
- name: Download provider-ui artifacts
uses: actions/download-artifact@v4
with:
name: provider-ui
path: /home/runner/work/meshery/meshery/provider-ui/out
- name: Run Meshery UI and Server
env:
PROVIDER_BASE_URLS: http://localhost:9876
PORT: 9081
ADAPTER_URLS: "localhost:10000 localhost:10001 localhost:10002 localhost:10003 localhost:10004 localhost:10009 localhost:10007"
run: |
make server &
sleep 90
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: ui
- name: Run Playwright End-to-End Tests
env:
MESHERY_SERVER_URL: "http://localhost:9081"
REMOTE_PROVIDER_URL: "https://staging-meshery.layer5.io"
REMOTE_PROVIDER_USER_EMAIL: ${{ secrets.REMOTE_PROVIDER_USER_EMAIL }}
REMOTE_PROVIDER_USER_PASSWORD: ${{ secrets.REMOTE_PROVIDER_USER_PASS }}
PROVIDER_TOKEN: ${{ secrets.PROVIDER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: npx playwright test --project=chromium --project=firefox --reporter="./tests/e2e/custom-playwright-reporter.js"
working-directory: ui
- name: Save PR number
if: ${{ !cancelled() }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/number
- name: Upload Test Report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: e2e-test-reporter
path: |
ui/test-report.md
pr/number
retention-days: 14
docker-build-test:
name: Docker build
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
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 -f install/docker/Dockerfile --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/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.IMAGE_NAME }}
# validate the swagger docs
swaggerci:
if: github.repository == 'meshery/meshery'
name: swagger-docs
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check if handlers were modified
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
modified:
- added|modified: "handlers/**"
- name: Setup go-swagger
if: steps.changes.outputs.modified == 'true'
uses: minchao/setup-go-swagger@v1
with:
version: v0.26.1
- name: swagger-spec
if: steps.changes.outputs.modified == 'true'
run: swagger generate spec -o ./server/helpers/swagger.yaml --scan-models
- name: swagger-docs
if: steps.changes.outputs.modified == 'true'
run: swagger generate spec -o ./docs/_data/swagger.yml --scan-models && swagger flatten ./docs/_data/swagger.yml -o ./docs/_data/swagger.yml --with-expand --format=yaml
# validate graphQL schema
garphql_validate:
name: Validate GraphQL schema
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check if schema was modified
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
modified:
- added|modified: 'server/internal/graphql/schema/schema.graphql'
- name: Set up Ruby
if: steps.filter.outputs.modified == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: graphql-docs
if: steps.filter.outputs.modified == 'true'
run: |
cd docs
bundle install
bundle exec rake graphql:compile_docs