feat: add UI tests workflow with configurable inputs and validation s… #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: UI Tests | ||
|
Check failure on line 1 in .github/workflows/qa-ui-workflow.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| install_tests_ref: | ||
| required: true | ||
| type: string | ||
| description: Install tests reference to use | ||
| test_set: | ||
| required: true | ||
| type: string | ||
| description: Test set to execute | ||
| selenoid_server_url: | ||
| required: false | ||
| type: string | ||
| description: Selenoid server to use | ||
| default: http://selenoid-ui.hel.mov.ai | ||
| proxmox_cluster_name: | ||
| required: false | ||
| type: string | ||
| default: hel0 | ||
| fleet_ips: | ||
| required: true | ||
| type: string | ||
| fleet_number_members: | ||
| required: false | ||
| type: number | ||
| default: 2 | ||
| backend_name: | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| slack_channel: | ||
| required: false | ||
| type: string | ||
| default: C05K2KF1UP8 #C02PB9A9F45 | ||
| with_fleet_tests: | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
| secrets: | ||
| gh_token: | ||
| required: true | ||
| auto_commit_user: | ||
| required: true | ||
| aws_key_id: | ||
| required: true | ||
| aws_secret_key_id: | ||
| required: true | ||
| slack_token_id: | ||
| required: true | ||
| jira_username: | ||
| required: true | ||
| jira_password: | ||
| required: true | ||
| xray_clientid: | ||
| required: true | ||
| xray_secret: | ||
| required: true | ||
| fleet_password: | ||
| required: true | ||
| proxmox_ve_username: | ||
| required: true | ||
| proxmox_ve_password: | ||
| required: true | ||
| ssh_pem_fleet_aws_vm: | ||
| required: true | ||
| auto_commit_pwd: | ||
| required: true | ||
| registry_user: | ||
| required: true | ||
| registry_password: | ||
| required: true | ||
| env: | ||
| CI_INTEGRATION_SCRIPTS_VERSION: "4.0.0.32" | ||
| GITHUB_API_USR: "OttoMation-Movai" | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_id }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key_id }} | ||
| AWS_DEFAULT_REGION: "us-east-1" | ||
| REGISTRY: registry.cloud.mov.ai | ||
| PROVISION_INFRA_REPO: "devops-tf-proxmox-bpg" | ||
| PROVISION_INFRA_VERSION: "2.2.0-2" | ||
| PROVISIONING_ENV_VERSION: "0.2.2-5" | ||
| PROVISIONING_ENV_REPO: devops-tf-env-conf | ||
| ARTIFACTS_RETENTION_DAYS: 15 | ||
| jobs: | ||
| Validate-features: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| - name: Feature file validation | ||
| shell: bash | ||
| env: | ||
| XRAY_CLIENTID: ${{ secrets.xray_clientid }} | ||
| XRAY_SECRET: ${{ secrets.xray_secret }} | ||
| JIRA_USERNAME: ${{ secrets.jira_username }} | ||
| JIRA_PASSWORD: ${{ secrets.jira_password }} | ||
| run: | | ||
| # create virtual environment | ||
| python3 -m venv venv --clear | ||
| . venv/bin/activate | ||
| # install tests requirements in venv | ||
| pip install \ | ||
| -i https://artifacts.cloud.mov.ai/repository/pypi-integration/simple \ | ||
| --extra-index-url https://pypi.org/simple \ | ||
| -r requirements.txt | ||
| xray download ${{ inputs.test_set }} | ||
| xray compare ./tests/feature/ | ||
| Validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| - name: Check if pre-commit config exists | ||
| id: check_files | ||
| uses: andstor/file-existence-action@v1 | ||
| with: | ||
| files: ".pre-commit-config.yaml" | ||
| - name: Install dependencies | ||
| if: steps.check_files.outputs.files_exists == 'true' | ||
| run: pip install pre-commit | ||
| - name: Run pre-commit | ||
| if: steps.check_files.outputs.files_exists == 'true' | ||
| run: pre-commit run --show-diff-on-failure --color=always --all-files | ||
| Resolve-fleet-context: | ||
| needs: [Validate] | ||
| runs-on: ubuntu-22.04 | ||
| outputs: | ||
| fleet_tests_list: ${{ steps.extract_fleet_tests_list.outputs.fleet_tests_list }} | ||
| slack_thread_id: ${{ steps.send-message.outputs.ts }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| - name: Extract fleet tests list | ||
| id: extract_fleet_tests_list | ||
| shell: bash | ||
| run: | | ||
| FLEET_TESTS=$(python3 -c " | ||
| import json | ||
| import yaml | ||
| with open('product-manifest.yaml') as f: | ||
| data = yaml.safe_load(f) | ||
| qa_config = data['product_components']['qa'] | ||
| fleet_test_names = [ | ||
| test_name for test_name, test_config in qa_config.items() | ||
| if isinstance(test_config, dict) and 'fleet' in test_config | ||
| ] | ||
| print(json.dumps(fleet_test_names)) | ||
| ") | ||
| echo "fleet_tests_list=${FLEET_TESTS}" >> $GITHUB_OUTPUT | ||
| - name: Prepare slack variables | ||
| id: pre_slack | ||
| shell: bash | ||
| run: | | ||
| 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}" | ||
| echo "msg=${MESSAGE}" >> $GITHUB_OUTPUT | ||
| - name: Send Slack Message | ||
| uses: slackapi/slack-github-action@v3 | ||
| id: send-message | ||
| with: | ||
| method: chat.postMessage | ||
| payload: | | ||
| { | ||
| "channel": "${{ inputs.slack_channel }}", | ||
| "text": "${{ steps.pre_slack.outputs.msg }}" | ||
| } | ||
| token: ${{ secrets.slack_token_id }} | ||
| # Run-tests: | ||
| # runs-on: qa-runner | ||
| # needs: [Validate] | ||
| # steps: | ||
| # - name: Cleanup Workspace | ||
| # uses: rtCamp/action-cleanup@master | ||
| # - name: Checkout | ||
| # uses: actions/checkout@v7 | ||
| # - name: Agent info | ||
| # id: agent_info | ||
| # run: | | ||
| # ip_tmp=$(hostname -I | awk '{print $1}') | ||
| # echo "ip=$ip_tmp" | tee >> $GITHUB_OUTPUT | ||
| # - name: Update/upgrade host packages | ||
| # run: | | ||
| # export DEBIAN_FRONTEND=noninteractive | ||
| # while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do echo Waiting for other software managers to finish... ; sleep 5;done | ||
| # sudo apt-get update | ||
| # while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do echo Waiting for other software managers to finish... ; sleep 5;done | ||
| # sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y | ||
| # - name: Setup environment | ||
| # shell: bash | ||
| # run: | | ||
| # # install test dependencies on host | ||
| # sudo apt install -y --allow-downgrades python3-rosnode python3-rosparam python3-rostopic | ||
| # # create virtual environment | ||
| # rm -rf venv | ||
| # python3 -m venv venv | ||
| # . venv/bin/activate | ||
| # # install tests requirements in venv | ||
| # pip install -r requirements.txt | ||
| # - name: UI tests | ||
| # id: ui | ||
| # shell: bash | ||
| # run: | | ||
| # export PYTHONPATH="${PYTHONPATH}:/usr/lib/python3/dist-packages" | ||
| # # activate venv | ||
| # . venv/bin/activate | ||
| # # tests execution | ||
| # pytest \ | ||
| # --hub_url ${{ inputs.selenoid_server_url }} \ | ||
| # --base_url https://${{ steps.agent_info.outputs.ip }}/ \ | ||
| # --install-platform \ | ||
| # | tee pytest-output.log | ||
| # - name: Save docker container logs | ||
| # if: always() | ||
| # shell: bash | ||
| # run: | | ||
| # # for sanity | ||
| # docker ps -a | ||
| # # save all container logs and inspect | ||
| # CONTAINERS=$(docker ps -a --format '{{.Names}}') | ||
| # for container in ${CONTAINERS}; do | ||
| # docker logs "${container}" &> "${container}.log" || true | ||
| # docker inspect "${container}" &> "${container}-inspect.log" | ||
| # done || true | ||
| # # movai-service | ||
| # journalctl -u movai-service --since '1hour ago' &> "movai-service.log" | ||
| # # spawner (mobros firmware) | ||
| # journalctl -u movai-service -t mobros --since '1hour ago' &> spawner-firmware.log || true | ||
| # - name: Stash QA artifacts | ||
| # if: always() | ||
| # shell: bash | ||
| # run: | | ||
| # # cleanup | ||
| # rm -rf qa_artifacts | ||
| # # tests artifacts | ||
| # # *.log and *.zip might not exist if the test fails early | ||
| # mkdir -p qa_artifacts | ||
| # cp -r *.log ./qa_artifacts || true | ||
| # cp -r *.tar ./qa_artifacts || true | ||
| # cp -r *.json ./qa_artifacts || true | ||
| # cp -r *.html ./qa_artifacts || true | ||
| # cp -r tests_artifacts ./qa_artifacts || true | ||
| # # install | ||
| # mkdir -p qa_artifacts/install | ||
| # cp -r ./installation ./qa_artifacts/ || true | ||
| # - name: Upload artifacts | ||
| # if: always() | ||
| # uses: actions/upload-artifact@v4 | ||
| # with: | ||
| # name: qa_artifacts_ui_tests | ||
| # path: qa_artifacts/* | ||
| # retention-days: 3 | ||
| # - name: Remove robots | ||
| # if: always() | ||
| # shell: bash | ||
| # run: | | ||
| # timeout 30 movai-cli remove --all || true | ||
| # - name: Docker cleanups | ||
| # if: always() | ||
| # shell: bash | ||
| # run: | | ||
| # if [ "$(docker ps -aq)" ]; then | ||
| # docker rm -f $(docker ps -aq) | ||
| # fi | ||
| # docker system prune -f | ||
| # docker image prune --all -f | ||
| Fleet-Validations: | ||
| needs: [Validate, Resolve-fleet-context] | ||
| uses: MOV-AI/.github/.github/workflows/integration-platform-remote-fleet-tests.yml@v3 | ||
| secrets: inherit | ||
| with: | ||
| collect_deployable_artifacts: true | ||
| fleet_test_infra_list: ${{ needs.Resolve-fleet-context.outputs.fleet_tests_list }} | ||
| slack_thread_id: ${{ needs.Resolve-fleet-context.outputs.slack_thread_id }} | ||
| backend_image_name_and_tag: ${{ inputs.backend_name }} | ||
| test_timeout: 120 | ||
| slack_channel: ${{ inputs.slack_channel }} | ||
| provision_tf_env_repo: ${{ env.PROVISIONING_ENV_REPO }} | ||
| provision_tf_env_version: ${{ env.PROVISIONING_ENV_VERSION }} | ||
| provision_infra_repo: ${{ env.PROVISION_INFRA_REPO }} | ||
| provision_infra_version: ${{ env.PROVISION_INFRA_VERSION }} | ||
| fleet_number_members: ${{ inputs.fleet_number_members }} | ||
| fleet_ips: ${{ inputs.fleet_ips }} | ||
| proxmox_cluster_name: ${{ inputs.proxmox_cluster_name }} | ||
| with_fleet_tests: ${{ inputs.with_fleet_tests }} | ||