-
Notifications
You must be signed in to change notification settings - Fork 10
333 lines (328 loc) · 11.9 KB
/
ci-actions.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: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
yarn install
yarn build
- name: Test
run: yarn test --coverage --watchAll=false
- uses: codecov/codecov-action@v1
with:
flags: unitests
e2e:
needs: [unit-test]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox]
services:
keycloak:
image: quay.io/keycloak/keycloak:12.0.2
ports:
- 8180:8080
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
options: >-
--health-cmd "curl --fail http://localhost:8080/auth || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
controls-db:
image: postgres:13.1
ports:
- 5433:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: controls_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
application-inventory-db:
image: postgres:13.1
ports:
- 5434:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: application_inventory_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
pathfinder-db:
image: postgres:13.1
ports:
- 5435:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: pathfinder_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Keycloak Admin CLI
uses: carlosthe19916/[email protected]
with:
server: http://keycloak:8080/auth
username: admin
password: admin
kcadm: create realms -f konveyor-realm.json
- name: Controls API
run: |
docker run -d --name controls --network ${{ job.services.controls-db.network }} --network-alias controls -p 8081:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://controls-db:5432/controls_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=controls-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret quay.io/konveyor/tackle-controls:latest-native
sleep 5s && docker logs controls
- name: Application inventory API
run: |
docker run -d --name application-inventory --network ${{ job.services.application-inventory-db.network }} --network-alias application-inventory -p 8082:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://application-inventory-db:5432/application_inventory_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=application-inventory-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \
-e IO_TACKLE_APPLICATIONINVENTORY_SERVICES_CONTROLS_SERVICE=controls:8080 \
quay.io/konveyor/tackle-application-inventory:latest-native
sleep 5s && docker logs application-inventory
- name: Pathfinder API
run: |
docker run -d --name pathfinder --network ${{ job.services.pathfinder-db.network }} --network-alias pathfinder -p 8083:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://pathfinder-db:5432/pathfinder_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=pathfinder-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret quay.io/konveyor/tackle-pathfinder:latest-native
sleep 5s && docker logs pathfinder
- name: Build
run: |
yarn install
yarn build:instrumentation
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: false
start: yarn run ui:start
wait-on: "http://localhost:3000"
wait-on-timeout: 120
config: pageLoadTimeout=100000
browser: ${{ matrix.browser }}
spec: cypress/**/*.test.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
if: failure()
with:
name: e2e-screenshots-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/screenshots
- uses: actions/upload-artifact@v1
if: always()
with:
name: e2e-videos-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/videos
- uses: codecov/codecov-action@v1
with:
flags: e2etests
container-images:
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'konveyor' }}
runs-on: ubuntu-latest
needs: [unit-test]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build
run: |
yarn install
yarn build
- name: Push to Quay.io
uses: elgohr/[email protected]
with:
registry: quay.io
name: konveyor/tackle-ui
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
dockerfile: Dockerfile
snapshot: false
tags: "main"
buildoptions: "--pull"
test-container-images:
needs: [container-images]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox]
services:
keycloak:
image: quay.io/keycloak/keycloak:12.0.2
ports:
- 8180:8080
env:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
options: >-
--health-cmd "curl --fail http://localhost:8080/auth || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
controls-db:
image: postgres:13.1
ports:
- 5433:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: controls_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
application-inventory-db:
image: postgres:13.1
ports:
- 5434:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: application_inventory_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
pathfinder-db:
image: postgres:13.1
ports:
- 5435:5432
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: pathfinder_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Keycloak Admin CLI
uses: carlosthe19916/[email protected]
with:
server: http://keycloak:8080/auth
username: admin
password: admin
kcadm: create realms -f konveyor-realm.json
- name: Controls API
run: |
docker run -d --name controls --network ${{ job.services.controls-db.network }} --network-alias controls -p 8081:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://controls-db:5432/controls_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=controls-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \
quay.io/konveyor/tackle-controls:latest-native
sleep 5s && docker logs controls
- name: Application inventory API
run: |
docker run -d --name application-inventory --network ${{ job.services.application-inventory-db.network }} --network-alias application-inventory -p 8082:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://application-inventory-db:5432/application_inventory_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=application-inventory-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \
-e IO_TACKLE_APPLICATIONINVENTORY_SERVICES_CONTROLS_SERVICE=controls:8080 \
quay.io/konveyor/tackle-application-inventory:latest-native
sleep 5s && docker logs application-inventory
- name: Pathfinder API
run: |
docker run -d --name pathfinder --network ${{ job.services.pathfinder-db.network }} --network-alias pathfinder -p 8083:8080 \
-e QUARKUS_HTTP_PORT=8080 \
-e QUARKUS_DATASOURCE_USERNAME=user \
-e QUARKUS_DATASOURCE_PASSWORD=password \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://pathfinder-db:5432/pathfinder_db \
-e QUARKUS_OIDC_AUTH_SERVER_URL=http://keycloak:8080/auth/realms/konveyor \
-e QUARKUS_OIDC_CLIENT_ID=pathfinder-api \
-e QUARKUS_OIDC_CREDENTIALS_SECRET=secret \
quay.io/konveyor/tackle-pathfinder:latest-native
sleep 5s && docker logs pathfinder
- name: Tackle UI
run: |
docker run -d --name tackle-ui --network ${{ job.services.keycloak.network }} --network-alias tackle-ui -p 3000:8080 \
-e SSO_REALM=konveyor \
-e SSO_CLIENT_ID=tackle-ui \
-e SSO_SERVER_URL=http://keycloak:8080/auth \
-e CONTROLS_API_URL=http://controls:8080/controls \
-e APPLICATION_INVENTORY_API_URL=http://application-inventory:8080/application-inventory \
-e PATHFINDER_API_URL=http://pathfinder:8080/pathfinder \
quay.io/konveyor/tackle-ui:main
sleep 5s && docker logs tackle-ui
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: false
wait-on: "http://localhost:3000"
wait-on-timeout: 120
config: pageLoadTimeout=100000
browser: ${{ matrix.browser }}
spec: cypress/**/*.test.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_auth_base_url: http://localhost:3000/auth
- uses: actions/upload-artifact@v1
if: failure()
with:
name: container-screenshots-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/screenshots
- uses: actions/upload-artifact@v1
if: always()
with:
name: container-videos-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/videos