-
Notifications
You must be signed in to change notification settings - Fork 28
166 lines (151 loc) · 6.63 KB
/
ui-tests.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
name: ui-tests-pipeline
on:
workflow_call:
inputs:
server_image:
description: "pmm-server docker image, default perconalab/pmm-server:dev-latest"
required: false
type: string
client_version:
description: "pmm2-client version Tarball or Dev-latest, default is dev-latest"
required: false
type: string
client_image:
description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest"
required: false
type: string
pmm_qa_branch:
description: "Branch for PMM-QA to checkout"
required: false
type: string
pmm_ui_branch:
description: "Branch for PMM-UI tests to checkout"
required: false
type: string
sha:
description: "SHA (leave empty if running manually, default - 'null')"
required: false
type: string
client_flags:
description: "example: --addclient=ps,1 --ps-version=5.7"
required: false
type: string
tags_for_tests:
description: "example: @settings-fb"
required: true
type: string
jobs:
ui-tests-e2e:
name: "e2e tests: ${{ inputs.tags_for_tests || '@settings-fb' }}"
# runs-on: ubuntu-latest Mongo Replica setup fails in ubuntu-latest for some reason. Additional investigation needed
runs-on: ubuntu-20.04
timeout-minutes: 60
env:
SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }}
CLIENT_IMAGE: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }}
CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }}
PMM_CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADMIN_PASSWORD: 'admin-password'
PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }}
PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }}
PMM_UI_BRANCH: ${{ inputs.pmm_ui_branch || 'main' }}
DOCKER_VERSION: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }}
CLIENT_DOCKER_VERSION: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }}
SHA: ${{ inputs.sha || 'null' }}
CLIENT_FLAGS: ${{ inputs.client_flags || '' }}
TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }}
# Environment variables for tests
BACKUP_LOCATION_ACCESS_KEY: ${{ secrets.BACKUP_LOCATION_ACCESS_KEY }}
BACKUP_LOCATION_SECRET_KEY: ${{ secrets.BACKUP_LOCATION_SECRET_KEY }}
steps:
- name: Create status check
if: ${{ github.event_name != 'pull_request' }}
uses: percona/gh-action-github-status-action@v2
continue-on-error: true
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: "${{ env.TAGS_FOR_TESTS }} UI tests"
description: "Test execution ${{ job.status }}"
state: "pending"
repository: ${{ github.repository }}
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
sha: ${{ env.SHA }}
- name: Checkout PMM UI tests
uses: actions/checkout@v4
with:
ref: ${{ env.PMM_UI_BRANCH }}
repository: percona/pmm-ui-tests
path: ./pmm-ui-tests
- name: Setup tools
run: |
npm install -g bats
sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \
/etc/apt/sources.list.d/clickhouse.list
sudo apt-get update
sudo apt-get install -y clickhouse-client
sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash
ls -la
git clone -b ${{ env.PMM_QA_BRANCH }} https://github.com/percona/pmm-qa
ls -la
pushd pmm-qa
wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh
chmod +x get_download_link.sh
popd
- name: Setup PMM2-Server
working-directory: ./pmm-ui-tests
run: |
PWD=$(pwd) PMM_SERVER_IMAGE=${{ env.DOCKER_VERSION }} docker-compose up -d
sleep 60
docker exec pmm-server change-admin-password ${{ env.ADMIN_PASSWORD }}
bash -x testdata/db_setup.sh
- name: Export path to pmm-qa repo
working-directory: ./pmm-qa
run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV
- name: Setup PMM2-Client
working-directory: ./pmm-qa
run: sudo bash -x pmm-tests/pmm2-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no
- name: Run Setup for E2E Tests
working-directory: ./pmm-qa
run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.CLIENT_FLAGS }} --pmm2
- name: Setup npm modules for e2e tests
working-directory: ./pmm-ui-tests
run: |
npm ci
envsubst < env.list > env.generated.list
- name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }}
working-directory: ./pmm-ui-tests
env:
SERVER_IP : "192.168.0.1"
PMM_UI_URL : "http://192.168.0.1/"
PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}"
run: |
sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js
./node_modules/.bin/codeceptjs run -c pr.codecept.js --grep "${{ env.TAGS_FOR_TESTS }}"
- uses: actions/github-script@v7
if: ${{ always() }}
id: artifact_name
with:
script: |
return `artifacts_for_${process.env.TAGS_FOR_TESTS.replaceAll('|', '')}`
result-encoding: string
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ steps.artifact_name.outputs.result }}
path: |
pmm-ui-tests/tests/output/*.png
- name: Create status check
if: ${{ github.event_name != 'pull_request' && always() }}
uses: percona/gh-action-github-status-action@v2
continue-on-error: true
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: "${{ env.TAGS_FOR_TESTS }} UI tests"
description: "Test execution ${{ job.status }}"
state: ${{ job.status }}
repository: ${{ github.repository }}
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
sha: ${{ env.SHA }}