-
Notifications
You must be signed in to change notification settings - Fork 1
215 lines (175 loc) · 8.99 KB
/
cucumber-test.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
name: Cucumber Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
jobs:
ai-reviewer-api-gcr:
name: Ai Reviewer Api GCR
runs-on: ubuntu-latest
steps:
- name: Pull Git repo.
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull ai-reviewer-api-builder
run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-api:builder || true
- name: build ai-reviewer-api-builder
run: docker build ./src/backend
-f ./src/backend/Dockerfile.ai-reviewer-api
--target build
-t ai-reviewer-api:builder
--build-arg SERVICE_NAME=ai-reviewer-api
--build-arg MVN_PROFILE=ai-reviewer
--build-arg STARTERS_V=v1.0.0
--cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-api:builder
- name: tag & push ai-reviewer-api to git container registry
if: github.event.pull_request.head.repo.full_name == github.repository
run: docker tag ai-reviewer-api:builder docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-api:builder && docker push docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-api:builder
ai-reviewer-mock-api-gcr:
name: Ai Reviewer Mock Api GCR
runs-on: ubuntu-latest
steps:
- name: Pull Git repo.
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull ai-reviewer-mock-api-builder
run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-mock-api:builder || true
- name: build ai-reviewer-mock-api
run: docker build ./src/backend
-f ./src/backend/Dockerfile.ai-reviewer-mock-api
--target build
-t ai-reviewer-mock-api:builder
--build-arg SERVICE_NAME=ai-reviewer-mock-api
--build-arg MVN_PROFILE=ai-reviewer-mock
--build-arg STARTERS_V=v1.0.0
--cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-mock-api:builder
- name: tag & push ai-reviewer-mock-api to git container registry
if: github.event.pull_request.head.repo.full_name == github.repository
run: docker tag ai-reviewer-mock-api:builder docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-mock-api:builder && docker push docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-mock-api:builder
ai-reviewer-admin-gcr:
name: Ai Reviewer Admin GCR
runs-on: ubuntu-latest
steps:
- name: Pull Git repo.
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull ai-reviewer-admin-builder
run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-admin:builder || true
- name: build ai-reviewer-admin-builder
run: docker build ./src/frontend/ai-reviewer-admin
--target build
-t ai-reviewer-admin:builder
--cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-admin:builder
- name: tag & push ai-reviewer-admin to git container registry
if: github.event.pull_request.head.repo.full_name == github.repository
run: docker tag ai-reviewer-admin:builder docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-admin:builder && docker push docker.pkg.github.com/$GITHUB_REPOSITORY/ai-reviewer-admin:builder
ai-keycloak-config-gcr:
name: Ai-Keycloack Config GCR
runs-on: ubuntu-latest
steps:
- name: Pull Git repo.
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull ai-reviewer-api-builder
run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/ai-keycloak-config:demo || true
- name: Pull ai-reviewer-api-builder
run: docker build ./infrastructure/keycloak
-t ai-keycloak-config:demo
--build-arg KEYCLOAK_URL=http://keycloak:8080
--cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/ai-keycloak-config:demo
- name: tag & push ai-keycloak-config to git container registry
if: github.event.pull_request.head.repo.full_name == github.repository
run: docker tag ai-keycloak-config:demo docker.pkg.github.com/$GITHUB_REPOSITORY/ai-keycloak-config:demo && docker push docker.pkg.github.com/$GITHUB_REPOSITORY/ai-keycloak-config:demo
# cucumber-tests:
# name: Runs cucumber-tests
# runs-on: ubuntu-latest
# needs: [ai-reviewer-api-gcr, ai-reviewer-mock-api-gcr, ai-reviewer-admin-gcr, ai-reviewer-cso-api-gcr, ai-keycloak-config-gcr]
# steps:
# - name: Pull Git repo.
# uses: actions/checkout@v2
# pulling images is faster than caching in most of the case
# - name: pull available docker images first
# run: docker-compose pull -q --parallel redis clamav mongodb keycloak#
# - name: Standup Infra
# run: docker-compose up -d redis clamav mongodb keycloak
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# registry: docker.pkg.github.com
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Cache local Maven repository
# uses: actions/cache@v2
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
# restore-keys: |
# ${{ runner.os }}-maven-
# - name: Pull images (Local REPO only)
# if: github.event.pull_request.head.repo.full_name == github.repository
# run: docker-compose -f docker-compose.yml -f test/docker-compose-integration.yml pull --parallel -q ai-reviewer-api ai-reviewer-mock-api ai-reviewer-admin ai-reviewer-cso-api keycloak-config
# - name: Standup Docker Pods (Local REPO only)
# if: github.event.pull_request.head.repo.full_name == github.repository
# run: docker-compose -f docker-compose.yml -f test/docker-compose-integration.yml up -d ai-reviewer-api ai-reviewer-mock-api ai-reviewer-admin ai-reviewer-cso-api
# - name: Standup Docker Pods (FORK only)
# if: github.event.pull_request.head.repo.full_name != github.repository
# run: docker-compose up -d ai-reviewer-api ai-reviewer-mock-api ai-reviewer-admin ai-reviewer-cso-api
# - name: Configure keycloak (Local REPO only)
# if: github.event.pull_request.head.repo.full_name == github.repository
# run: |
# docker-compose -f docker-compose.yml -f test/docker-compose-integration.yml up keycloak-config
# - name: Configure keycloak (FORK only)
# if: github.event.pull_request.head.repo.full_name != github.repository
# run: |
# docker-compose up keycloak-config
# - name: Running Integration Tests
# env:
# DOCKERIZE_VERSION: v0.6.1
# continue-on-error: true
# id: cucumber-test
# run: |
#Maven requires chrome driver.
# wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# sudo apt-get -qq -y install ./google-chrome-stable_current_amd64.deb
#We need to test if ai-reviewer-api pod and service is running before we can proceed. Using dockerize to proceed only after the below ports can be reached.
# wget -q https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# tar -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# ./dockerize -wait http://127.0.0.1:1337/api/isServerUp -timeout 120s -wait http://127.0.0.1:8090/actuator/health -timeout 120s -wait http://127.0.0.1:3002/actuator/health -timeout 120s -wait http://127.0.0.1:8686/actuator/health -timeout 120s
# mvn verify -ntp -f test/pom.xml
#Upload Spark report for debugging purposes
# - name: Upload Spark report for debugging purposes
# uses: actions/upload-artifact@v2
# with:
# name: cucumber-spark-report
# path: ./test/test-output/extent/Spark/Index.html
#Upload Cucumber JSON for debugging purposes
# - name: Upload Cucumber JSON for debugging purposes
# uses: actions/upload-artifact@v2
# with:
# name: cucumber-json-report
# path: ./test/target/cucumber-reports/CucumberTestReport.json
# - name: Set action status
# if: steps.cucumber-test.outcome != 'success'
# run: exit 1