forked from SAP-archive/xsk
-
Notifications
You must be signed in to change notification settings - Fork 0
265 lines (245 loc) · 9.98 KB
/
nightly.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
name: Nightly Build
on:
schedule:
- cron: "0 22 * * *"
workflow_dispatch:
jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Download JDK
- name: Download sapmachine JDK 17
run: |
download_url="https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.2/sapmachine-jdk-17.0.2_linux-x64_bin.tar.gz"
wget -O "${RUNNER_TEMP}/sapmachine-jdk-17.tar.gz" "${download_url}"
# Setup JDK
- name: Setup sapmachine JDK 17
uses: actions/setup-java@v2
with:
distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/sapmachine-jdk-17.tar.gz
java-version: '17.0.2'
architecture: x64
# Setup Google Chrome
- name: Setup Google Chrome
uses: browser-actions/setup-chrome@latest
- name: Verify Google Chrome
run: chrome --version
# Setup Firefox
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Verify Firefox
run: firefox --version
# Build and Run XSK
- name: Build XSK
run: mvn clean install
- name: Docker Build XSK
run: docker build -t dirigiblelabs/xsk-selenium-build /home/runner/work/xsk/xsk/releng/server/.
- name: Docker Run XSK
run: docker run -d --name dirigible -p 8080:8080 dirigiblelabs/xsk-selenium-build
# Wait for XSK to Startup
- name: Wait XSK Startup
uses: nick-invision/retry@v2
with:
timeout_seconds: 15
max_attempts: 10
warning_on_retry: false
command: curl -m 5 --silent --fail --request GET http://127.0.0.1:8080/services/v4/healthcheck | jq --exit-status -n 'inputs | if has("status") then .status=="Ready" else false end' > /dev/null
# Run Selenium tests on locally running XSK
- name: Run Integration & Selenium Tests
working-directory: ./integration-tests
run: mvn clean test -P itests -fae -Dhana.url="${{secrets.ITESTS_HANA_URL}}" -Dhana.username="${{secrets.ITESTS_HANA_USERNAME}}" -Dhana.password="${{secrets.ITESTS_HANA_PASSWORD}}"
env:
ITESTS_SELENIUM_MODE: 'headless'
ITESTS_SELENIUM_NEO_REGION: ${{ secrets.ITESTS_SELENIUM_NEO_REGION }}
ITESTS_SELENIUM_NEO_SUBACCOUNT: ${{ secrets.ITESTS_SELENIUM_NEO_SUBACCOUNT }}
ITESTS_SELENIUM_NEO_USERNAME: ${{ secrets.ITESTS_SELENIUM_NEO_USERNAME }}
ITESTS_SELENIUM_NEO_PASSWORD: ${{ secrets.ITESTS_SELENIUM_NEO_PASSWORD }}
ITESTS_SELENIUM_HANA_DB_SCHEMA: ${{ secrets.ITESTS_SELENIUM_HANA_DB_SCHEMA }}
ITESTS_SELENIUM_HANA_DB_SCHEMA_2: ${{ secrets.ITESTS_SELENIUM_HANA_DB_SCHEMA_2 }}
ITESTS_SELENIUM_HANA_DB_USERNAME: ${{ secrets.ITESTS_SELENIUM_HANA_DB_USERNAME }}
ITESTS_SELENIUM_HANA_DB_PASSWORD: ${{ secrets.ITESTS_SELENIUM_HANA_DB_PASSWORD }}
# Set XSK Kyma context
- name: Kubernetes set context
uses: Azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.ITESTS_KYMA_CONFIG }}
# Deploy XSK on Kyma cluster
- name: Deploy xsk
run: |
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: xsk
namespace: ${{ secrets.ITESTS_KYMA_NAMESPACE }}
spec:
replicas: 1
selector:
matchLabels:
app: xsk
template:
metadata:
labels:
app: xsk
spec:
serviceAccountName: ${{ secrets.ITESTS_KYMA_SERVICEACCOUNTNAME }}
containers:
- name: xsk
image: dirigiblelabs/xsk-kyma:latest
imagePullPolicy: Always
env:
- name: DIRIGIBLE_THEME_DEFAULT
value: fiori
- name: DIRIGIBLE_HOST
value: https://${{ secrets.ITESTS_KYMA_DIRIGIBLE_HOST }}
- name: url
value: ${{ secrets.ITESTS_KYMA_XSUAA_URL }}
- name: clientid
value: ${{ secrets.ITESTS_KYMA_XSUAA_CLIENT_ID }}
- name: clientsecret
value: ${{ secrets.ITESTS_KYMA_XSUAA_CLIENT_SECRET }}
- name: verificationkey
value: ${{ secrets.ITESTS_KYMA_XSUAA_VERIFICATION_KEY }}
- name: xsappname
value: ${{ secrets.ITESTS_KYMA_XSUAA_XSAPP_NAME }}
- name: DIRIGIBLE_DATABASE_PROVIDER
value: custom
- name: DIRIGIBLE_DATABASE_CUSTOM_DATASOURCES
value: HANA
- name: DIRIGIBLE_DATABASE_DATASOURCE_NAME_DEFAULT
value: HANA
- name: HANA_URL
value: ${{ secrets.ITESTS_KYMA_HANA_URL }}
- name: HANA_DRIVER
value: com.sap.db.jdbc.Driver
- name: HANA_USERNAME
value: ${{ secrets.ITESTS_KYMA_HANA_USERNAME }}
- name: HANA_PASSWORD
value: ${{ secrets.ITESTS_KYMA_HANA_PASSWORD }}
volumeMounts:
- name: xsk-volume
mountPath: /usr/local/tomcat/target/dirigible/repository
ports:
- containerPort: 8080
name: xsk
protocol: TCP
volumes:
- name: xsk-volume
persistentVolumeClaim:
claimName: xsk-claim
---
apiVersion: v1
kind: Service
metadata:
labels:
app: xsk
name: xsk
namespace: ${{ secrets.ITESTS_KYMA_NAMESPACE }}
spec:
ports:
- name: xsk
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: xsk
type: ClusterIP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: xsk-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: gateway.kyma-project.io/v1alpha1
kind: APIRule
metadata:
name: xsk
namespace: ${{ secrets.ITESTS_KYMA_NAMESPACE }}
spec:
gateway: kyma-gateway.kyma-system.svc.cluster.local
rules:
- accessStrategies:
- config: {}
handler: noop
methods:
- GET
- POST
- PUT
- PATCH
- DELETE
- HEAD
path: /.*
service:
host: ${{ secrets.ITESTS_KYMA_DIRIGIBLE_HOST }}
name: xsk
port: 8080
EOF
shell: bash
# Wait for XSK Kyma Deployment to Startup
- name: Wait XSK Kyma Startup
uses: nick-invision/retry@v2
with:
timeout_seconds: 120
max_attempts: 50
warning_on_retry: false
command: curl -m 5 --silent --fail --request GET https://xsk.xsk-it.promart.shoot.canary.k8s-hana.ondemand.com/services/v4/healthcheck | jq --exit-status -n 'inputs | if has("status") then .status=="Ready" else false end' > /dev/null
# Delete XSK Kyma deployment resources
- name: Delete the deployment
run: |
kubectl delete deployment xsk -n ${{ secrets.ITESTS_KYMA_NAMESPACE }}
kubectl delete service xsk -n ${{ secrets.ITESTS_KYMA_NAMESPACE }}
kubectl delete apirules xsk -n ${{ secrets.ITESTS_KYMA_NAMESPACE }}
kubectl delete persistentVolumeClaim xsk-claim -n ${{ secrets.ITESTS_KYMA_NAMESPACE }}
shell: bash
# Copy logs to '/xsk/test_results' and commit the directory
- name: Get current Time
if: ${{ failure() }}
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD_HH-mm-ss
utcOffset: "+02:00"
- name: Create Results Dir
if: ${{ failure() }}
run: mkdir /home/runner/work/xsk/xsk/test_results
- name: Copy Tomcat Logs
if: ${{ failure() }}
run: docker cp $(docker ps -aqf "name=dirigible"):/usr/local/tomcat/logs/. /home/runner/work/xsk/xsk/test_results/tomcat_logs
- name: Copy Surefire Reports
if: ${{ failure() }}
run: find ./ -name 'surefire-reports' -exec cp -prv '{}' '/home/runner/work/xsk/xsk/test_results/surefire-reports' ';'
- name: Copy Selenium Output
if: ${{ failure() }}
run: find ./ -name 'selenium' -exec cp -prv '{}' '/home/runner/work/xsk/xsk/test_results/selenium_logs' ';'
- name: Commit test_results directory
if: ${{ failure() }}
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.INTEGRATION_TESTS_RESULTS_REPO_TOKEN }}
with:
source_file: '/home/runner/work/xsk/xsk/test_results'
destination_repo: "${{ secrets.INTEGRATION_TESTS_RESULTS_REPO_NAME }}"
destination_branch: "master"
destination_folder: "nightly/results_${{ steps.current-time.outputs.formattedTime }}_gmtplus_2"
user_email: "${{ secrets.INTEGRATION_TESTS_RESULTS_REPO_MAIL }}"
user_name: "${{ secrets.INTEGRATION_TESTS_RESULTS_REPO_UNAME }}"
commit_message: "Nighty results from: ${{ steps.current-time.outputs.readableTime }}"
- name: Slack Notification
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
payload: "{\"type\":\"Nightly Build\",\"url\":\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}