_runner-e2e-tests #25
Workflow file for this run
This file contains 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: _runner-e2e-tests | |
on: | |
workflow_dispatch: | |
inputs: | |
pmm_ui_tests_branch: | |
description: "Branch for PMM-UI tests to checkout" | |
required: false | |
type: string | |
pmm_qa_branch: | |
description: "Branch for qa-integration to checkout" | |
required: false | |
type: string | |
pmm_server_image: | |
description: 'PMM Server docker image' | |
default: 'perconalab/pmm-server:3-dev-latest' | |
required: false | |
type: string | |
pmm_client_image: | |
description: 'pmm2-client docker image' | |
default: 'perconalab/pmm-client:3-dev-latest' | |
required: false | |
type: string | |
pmm_client_version: | |
description: 'PMM Client version (3-dev-latest|pmm3-rc|x.xx.x|https...)' | |
default: '3-dev-latest' | |
required: false | |
type: string | |
setup_services: | |
description: "Setup arguments, ex.: --database=ps --database=psmdb" | |
required: false | |
type: string | |
direct_mongo_setup_script: | |
description: "setup psmdb without framework with command like: './start-rs-only.sh'" | |
type: string | |
tags_for_tests: | |
description: "example: @settings-fb" | |
required: true | |
type: string | |
sha: | |
description: "SHA (leave default if running manually)" | |
default: 'null' | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
pmm_ui_tests_branch: | |
required: false | |
type: string | |
pmm_qa_branch: | |
required: false | |
type: string | |
pmm_server_image: | |
required: false | |
type: string | |
pmm_client_version: | |
required: false | |
type: string | |
pmm_client_image: | |
required: false | |
type: string | |
setup_services: | |
required: false | |
type: string | |
direct_mongo_setup_script: | |
required: false | |
type: string | |
tags_for_tests: | |
required: true | |
type: string | |
sha: | |
required: false | |
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-latest | |
timeout-minutes: 60 | |
env: | |
SHA: ${{ inputs.sha || 'null' }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ADMIN_PASSWORD: 'admin-password' | |
PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'v3' }} | |
PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'v3' }} | |
PMM_UI_BRANCH: ${{ inputs.pmm_ui_tests_branch || 'v3' }} | |
DOCKER_VERSION: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:3-dev-latest' }} | |
CLIENT_DOCKER_VERSION: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:3-dev-latest' }} | |
PMM_CLIENT_VERSION: ${{ inputs.pmm_client_version || '3-dev-latest' }} | |
WIZARD_ARGS: ${{ inputs.setup_services || '' }} | |
DIRECT_MONGO_SETUP_SCRIPT: ${{ inputs.direct_mongo_setup_script || '' }} | |
TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }} | |
steps: | |
- name: Create status check | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: percona/gh-action-github-status-action@v1 | |
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: Checkout qa-integration repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.PMM_QA_BRANCH }} | |
repository: Percona-Lab/qa-integration | |
path: ./qa-integration | |
- name: Setup tools | |
run: | | |
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 apt-get install -y ansible | |
sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash | |
- 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 qa-integration repo | |
working-directory: qa-integration | |
run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV | |
- name: Setup PMM-Client | |
working-directory: qa-integration/pmm_qa | |
run: sudo bash -x pmm3-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no | |
# - name: Run PSMDB direct setup script | |
# if: ${{ env.DIRECT_MONGO_SETUP_SCRIPT != '' }} | |
# working-directory: qa-integration/pmm_psmdb-pbm_setup | |
# run: bash ${{ env.DIRECT_MONGO_SETUP_SCRIPT }} | |
- name: Setup tmate session | |
if: ${{ always() }} | |
uses: percona/gh-action-action-tmate@v2 | |
- name: Run Setup for E2E Tests | |
# if: ${{ !contains(env.WIZARD_ARGS, 'psmdb') }} | |
working-directory: qa-integration/pmm_qa | |
run: | | |
mkdir -m 777 -p /tmp/backup_data | |
python3 -m venv virtenv | |
. virtenv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
python pmm-framework.py --pmm-server-password=${{ env.ADMIN_PASSWORD }} --verbose ${{ env.WIZARD_ARGS }} | |
- 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@v1 | |
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 }} | |
# - name: Setup tmate session on failure | |
# if: ${{ always() }} | |
# uses: percona/gh-action-action-tmate@v2 |