-
Notifications
You must be signed in to change notification settings - Fork 27
92 lines (80 loc) · 3.28 KB
/
_e2e-test.yml
File metadata and controls
92 lines (80 loc) · 3.28 KB
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
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Call - E2E Test
permissions: read-all
on:
workflow_call:
inputs:
node:
default: "xeon"
required: true
type: string
tag:
default: "latest"
required: false
type: string
jobs:
call-e2e-test:
runs-on: "k8s-${{ inputs.node }}"
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*
- name: Get Checkout Ref
run: |
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
echo "CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge" >> $GITHUB_ENV
else
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
fi
- name: Checkout out Repo
uses: actions/checkout@v4
with:
ref: ${{ env.CHECKOUT_REF }}
fetch-depth: 0
- name: Deploy GenAI Studio
run: |
sudo apt install ansible -y
ansible-playbook genai-studio.yml -e "container_registry=${OPEA_IMAGE_REPO}opea" -e "container_tag=${{ inputs.tag }}" -e "mysql_host=mysql.mysql.svc.cluster.local" -e "http_proxy=${http_proxy}" || {
echo "Ansible playbook failed. Checking pod status..."
echo "=== Pods in studio namespace ==="
kubectl get pods -n studio
echo "=== Logs and events for non-Ready pods in studio namespace ==="
for pod in $(kubectl get pods -n studio --field-selector=status.phase!=Running,status.phase!=Succeeded -o jsonpath='{.items[*].metadata.name}'); do
echo "--- Pod: $pod ---"
kubectl describe pod $pod -n studio
kubectl logs $pod -n studio --all-containers=true --tail=100 || echo "Could not fetch logs for $pod"
done
exit 1
}
sleep 5
working-directory: ${{ github.workspace }}/setup-scripts/setup-genai-studio/
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.18.0'
- name: Install Dependencies
run: |
npm install
npx playwright install
npx playwright install-deps
working-directory: ${{ github.workspace }}/tests/playwright
- name: Update Playwright Config
run: |
NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
sed -i "s|baseURL:.*|baseURL: \"https://$NODE_IP:30007\",|" playwright.config.js
working-directory: ${{ github.workspace }}/tests/playwright
- name: Run Playwright Tests
run: npx playwright test
working-directory: ${{ github.workspace }}/tests/playwright
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: ${{ github.workspace }}/tests/playwright/playwright-report
- name: Cleanup GenAI Studio
if: always()
run: |
echo "Running GenAI Studio cleanup script..."
./cleanup-genai-studio.sh || echo "Cleanup script completed with warnings"
working-directory: ${{ github.workspace }}/setup-scripts/setup-genai-studio/