Skip to content

Commit db7c845

Browse files
committed
feat: add UI tests workflow with configurable inputs and validation steps
1 parent b34a06f commit db7c845

1 file changed

Lines changed: 319 additions & 0 deletions

File tree

Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
name: UI Tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
install_tests_ref:
6+
required: true
7+
type: string
8+
description: Install tests reference to use
9+
test_set:
10+
required: true
11+
type: string
12+
description: Test set to execute
13+
selenoid_server_url:
14+
required: false
15+
type: string
16+
description: Selenoid server to use
17+
default: http://selenoid-ui.hel.mov.ai
18+
proxmox_cluster_name:
19+
required: false
20+
type: string
21+
default: hel0
22+
fleet_ips:
23+
required: true
24+
type: string
25+
fleet_number_members:
26+
required: false
27+
type: number
28+
default: 2
29+
backend_name:
30+
required: false
31+
type: string
32+
default: ''
33+
slack_channel:
34+
required: false
35+
type: string
36+
default: C05K2KF1UP8 #C02PB9A9F45
37+
with_fleet_tests:
38+
required: false
39+
type: boolean
40+
default: true
41+
secrets:
42+
gh_token:
43+
required: true
44+
auto_commit_user:
45+
required: true
46+
aws_key_id:
47+
required: true
48+
aws_secret_key_id:
49+
required: true
50+
slack_token_id:
51+
required: true
52+
jira_username:
53+
required: true
54+
jira_password:
55+
required: true
56+
xray_clientid:
57+
required: true
58+
xray_secret:
59+
required: true
60+
fleet_password:
61+
required: true
62+
proxmox_ve_username:
63+
required: true
64+
proxmox_ve_password:
65+
required: true
66+
ssh_pem_fleet_aws_vm:
67+
required: true
68+
auto_commit_pwd:
69+
required: true
70+
registry_user:
71+
required: true
72+
registry_password:
73+
required: true
74+
75+
env:
76+
CI_INTEGRATION_SCRIPTS_VERSION: "4.0.0.32"
77+
GITHUB_API_USR: "OttoMation-Movai"
78+
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_id }}
79+
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key_id }}
80+
AWS_DEFAULT_REGION: "us-east-1"
81+
REGISTRY: registry.cloud.mov.ai
82+
PROVISION_INFRA_REPO: "devops-tf-proxmox-bpg"
83+
PROVISION_INFRA_VERSION: "2.2.0-2"
84+
PROVISIONING_ENV_VERSION: "0.2.2-5"
85+
PROVISIONING_ENV_REPO: devops-tf-env-conf
86+
ARTIFACTS_RETENTION_DAYS: 15
87+
88+
jobs:
89+
Validate-features:
90+
runs-on: ubuntu-22.04
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v7
94+
95+
- name: Feature file validation
96+
shell: bash
97+
env:
98+
XRAY_CLIENTID: ${{ secrets.xray_clientid }}
99+
XRAY_SECRET: ${{ secrets.xray_secret }}
100+
JIRA_USERNAME: ${{ secrets.jira_username }}
101+
JIRA_PASSWORD: ${{ secrets.jira_password }}
102+
run: |
103+
# create virtual environment
104+
python3 -m venv venv --clear
105+
. venv/bin/activate
106+
107+
# install tests requirements in venv
108+
pip install \
109+
-i https://artifacts.cloud.mov.ai/repository/pypi-integration/simple \
110+
--extra-index-url https://pypi.org/simple \
111+
-r requirements.txt
112+
113+
xray download ${{ inputs.test_set }}
114+
xray compare ./tests/feature/
115+
116+
Validate:
117+
runs-on: ubuntu-latest
118+
steps:
119+
- name: Checkout
120+
uses: actions/checkout@v7
121+
122+
- name: Check if pre-commit config exists
123+
id: check_files
124+
uses: andstor/file-existence-action@v1
125+
with:
126+
files: ".pre-commit-config.yaml"
127+
128+
- name: Install dependencies
129+
if: steps.check_files.outputs.files_exists == 'true'
130+
run: pip install pre-commit
131+
132+
- name: Run pre-commit
133+
if: steps.check_files.outputs.files_exists == 'true'
134+
run: pre-commit run --show-diff-on-failure --color=always --all-files
135+
136+
Resolve-fleet-context:
137+
needs: [Validate]
138+
runs-on: ubuntu-22.04
139+
outputs:
140+
fleet_tests_list: ${{ steps.extract_fleet_tests_list.outputs.fleet_tests_list }}
141+
slack_thread_id: ${{ steps.send-message.outputs.ts }}
142+
steps:
143+
- name: Checkout
144+
uses: actions/checkout@v7
145+
146+
- name: Extract fleet tests list
147+
id: extract_fleet_tests_list
148+
shell: bash
149+
run: |
150+
FLEET_TESTS=$(python3 -c "
151+
import json
152+
import yaml
153+
154+
with open('product-manifest.yaml') as f:
155+
data = yaml.safe_load(f)
156+
157+
qa_config = data['product_components']['qa']
158+
fleet_test_names = [
159+
test_name for test_name, test_config in qa_config.items()
160+
if isinstance(test_config, dict) and 'fleet' in test_config
161+
]
162+
print(json.dumps(fleet_test_names))
163+
")
164+
echo "fleet_tests_list=${FLEET_TESTS}" >> $GITHUB_OUTPUT
165+
166+
- name: Prepare slack variables
167+
id: pre_slack
168+
shell: bash
169+
run: |
170+
MESSAGE=":loading: QA UI Fleet validations started for ${GITHUB_REPOSITORY} (${GITHUB_REF#refs/heads/}) - Run: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
171+
echo "msg=${MESSAGE}" >> $GITHUB_OUTPUT
172+
173+
- name: Send Slack Message
174+
uses: slackapi/slack-github-action@v3
175+
id: send-message
176+
with:
177+
method: chat.postMessage
178+
payload: |
179+
{
180+
"channel": "${{ inputs.slack_channel }}",
181+
"text": "${{ steps.pre_slack.outputs.msg }}"
182+
}
183+
token: ${{ secrets.slack_token_id }}
184+
185+
# Run-tests:
186+
# runs-on: qa-runner
187+
# needs: [Validate]
188+
# steps:
189+
# - name: Cleanup Workspace
190+
# uses: rtCamp/action-cleanup@master
191+
192+
# - name: Checkout
193+
# uses: actions/checkout@v7
194+
195+
# - name: Agent info
196+
# id: agent_info
197+
# run: |
198+
# ip_tmp=$(hostname -I | awk '{print $1}')
199+
# echo "ip=$ip_tmp" | tee >> $GITHUB_OUTPUT
200+
201+
# - name: Update/upgrade host packages
202+
# run: |
203+
# export DEBIAN_FRONTEND=noninteractive
204+
# while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do echo Waiting for other software managers to finish... ; sleep 5;done
205+
# sudo apt-get update
206+
# while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do echo Waiting for other software managers to finish... ; sleep 5;done
207+
# sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y
208+
209+
# - name: Setup environment
210+
# shell: bash
211+
# run: |
212+
# # install test dependencies on host
213+
# sudo apt install -y --allow-downgrades python3-rosnode python3-rosparam python3-rostopic
214+
215+
# # create virtual environment
216+
# rm -rf venv
217+
# python3 -m venv venv
218+
# . venv/bin/activate
219+
220+
# # install tests requirements in venv
221+
# pip install -r requirements.txt
222+
223+
# - name: UI tests
224+
# id: ui
225+
# shell: bash
226+
# run: |
227+
# export PYTHONPATH="${PYTHONPATH}:/usr/lib/python3/dist-packages"
228+
# # activate venv
229+
# . venv/bin/activate
230+
# # tests execution
231+
# pytest \
232+
# --hub_url ${{ inputs.selenoid_server_url }} \
233+
# --base_url https://${{ steps.agent_info.outputs.ip }}/ \
234+
# --install-platform \
235+
# | tee pytest-output.log
236+
237+
# - name: Save docker container logs
238+
# if: always()
239+
# shell: bash
240+
# run: |
241+
# # for sanity
242+
# docker ps -a
243+
244+
# # save all container logs and inspect
245+
# CONTAINERS=$(docker ps -a --format '{{.Names}}')
246+
# for container in ${CONTAINERS}; do
247+
# docker logs "${container}" &> "${container}.log" || true
248+
# docker inspect "${container}" &> "${container}-inspect.log"
249+
# done || true
250+
251+
# # movai-service
252+
# journalctl -u movai-service --since '1hour ago' &> "movai-service.log"
253+
254+
# # spawner (mobros firmware)
255+
# journalctl -u movai-service -t mobros --since '1hour ago' &> spawner-firmware.log || true
256+
257+
# - name: Stash QA artifacts
258+
# if: always()
259+
# shell: bash
260+
# run: |
261+
# # cleanup
262+
# rm -rf qa_artifacts
263+
264+
# # tests artifacts
265+
# # *.log and *.zip might not exist if the test fails early
266+
# mkdir -p qa_artifacts
267+
# cp -r *.log ./qa_artifacts || true
268+
# cp -r *.tar ./qa_artifacts || true
269+
# cp -r *.json ./qa_artifacts || true
270+
# cp -r *.html ./qa_artifacts || true
271+
# cp -r tests_artifacts ./qa_artifacts || true
272+
273+
# # install
274+
# mkdir -p qa_artifacts/install
275+
# cp -r ./installation ./qa_artifacts/ || true
276+
277+
# - name: Upload artifacts
278+
# if: always()
279+
# uses: actions/upload-artifact@v4
280+
# with:
281+
# name: qa_artifacts_ui_tests
282+
# path: qa_artifacts/*
283+
# retention-days: 3
284+
285+
# - name: Remove robots
286+
# if: always()
287+
# shell: bash
288+
# run: |
289+
# timeout 30 movai-cli remove --all || true
290+
291+
# - name: Docker cleanups
292+
# if: always()
293+
# shell: bash
294+
# run: |
295+
# if [ "$(docker ps -aq)" ]; then
296+
# docker rm -f $(docker ps -aq)
297+
# fi
298+
# docker system prune -f
299+
# docker image prune --all -f
300+
301+
Fleet-Validations:
302+
needs: [Validate, Resolve-fleet-context]
303+
uses: MOV-AI/.github/.github/workflows/integration-platform-remote-fleet-tests.yml@v3
304+
secrets: inherit
305+
with:
306+
collect_deployable_artifacts: true
307+
fleet_test_infra_list: ${{ needs.Resolve-fleet-context.outputs.fleet_tests_list }}
308+
slack_thread_id: ${{ needs.Resolve-fleet-context.outputs.slack_thread_id }}
309+
backend_image_name_and_tag: ${{ inputs.backend_name }}
310+
test_timeout: 120
311+
slack_channel: ${{ inputs.slack_channel }}
312+
provision_tf_env_repo: ${{ env.PROVISIONING_ENV_REPO }}
313+
provision_tf_env_version: ${{ env.PROVISIONING_ENV_VERSION }}
314+
provision_infra_repo: ${{ env.PROVISION_INFRA_REPO }}
315+
provision_infra_version: ${{ env.PROVISION_INFRA_VERSION }}
316+
fleet_number_members: ${{ inputs.fleet_number_members }}
317+
fleet_ips: ${{ inputs.fleet_ips }}
318+
proxmox_cluster_name: ${{ inputs.proxmox_cluster_name }}
319+
with_fleet_tests: ${{ inputs.with_fleet_tests }}

0 commit comments

Comments
 (0)