Run test manually #165
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: Run test manually | |
on: | |
workflow_dispatch: | |
inputs: | |
API_URI: | |
type: string | |
description: Type Api url if you want to run tests on other environment. Note that DB won't be restored for tests, you have to do it manually. | |
required: false | |
DASHBOARD_URL: | |
type: string | |
required: false | |
description: Type dashboard url if you want to run tests on other environment. Note that DB won't be restored for tests, you have to do it manually. | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
initialize-cloud: | |
if: github.event.inputs.API_URI == '' | |
runs-on: ubuntu-22.04 | |
outputs: | |
POOL_NAME: ${{ steps.pool_variables.outputs.POOL_NAME }} | |
POOL_INSTANCE: ${{ steps.pool_variables.outputs.POOL_INSTANCE }} | |
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }} | |
API_URL: ${{ steps.cloud_variables.outputs.API_URL }} | |
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }} | |
BACKUP_VER: ${{ steps.cloud_variables.outputs.BACKUP_VER }} | |
BACKUP_NAME: ${{ steps.cloud_variables.outputs.BACKUP_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: ./.github/actions | |
- name: Set variables mode | |
id: set_variables_mode | |
shell: bash | |
run: | | |
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then | |
echo "MODE=main" >> $GITHUB_OUTPUT | |
else | |
echo "MODE=release" >> $GITHUB_OUTPUT | |
fi | |
- name: Generate variables | |
id: cloud_variables | |
uses: ./.github/actions/prepare-tests-variables | |
with: | |
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }} | |
MODE: ${{ steps.set_variables_mode.outputs.MODE }} | |
- name: Prepare instances | |
id: pool_variables | |
uses: ./.github/actions/prepare-instance | |
with: | |
STRATEGY: reload | |
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }} | |
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }} | |
API_URL: ${{ steps.cloud_variables.outputs.API_URL }} | |
POOL_NAME: ${{ steps.cloud_variables.outputs.POOL_NAME }} | |
POOL_INSTANCE: ${{ steps.cloud_variables.outputs.POOL_INSTANCE }} | |
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }} | |
create-run-on-testmo: | |
runs-on: ubuntu-22.04 | |
needs: initialize-cloud | |
if: always() | |
outputs: | |
testmo-run-id: ${{ steps.init-testmo.outputs.testmo-run-id }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/testmo/testmo-init | |
with: | |
testmoUrl: ${{ secrets.TESTMO_URL }} | |
testmoToken: ${{ secrets.TESTMO_TOKEN }} | |
testmoRunName: "Playwright run ${{github.ref_name}}" | |
id: init-testmo | |
run-tests: | |
runs-on: ubuntu-22.04 | |
needs: ["initialize-cloud", "create-run-on-testmo"] | |
if: always() | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [1/2, 2/2] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run playwright tests | |
uses: ./.github/actions/run-pw-tests | |
with: | |
SHARD: ${{ matrix.shard }} | |
BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL || github.event.inputs.DASHBOARD_URL }} | |
API_URL: ${{ needs.initialize-cloud.outputs.API_URL || github.event.inputs.API_URI }} | |
E2E_USER_NAME: ${{ secrets.E2E_USER_NAME }} | |
E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }} | |
E2E_PERMISSIONS_USERS_PASSWORD: ${{ secrets.E2E_PERMISSIONS_USERS_PASSWORD }} | |
MAILPITURL: ${{ secrets.MAILPITURL }} | |
PW_WORKERS: ${{ vars.PW_WORKERS }} | |
PW_RETRIES: ${{ vars.PW_RETRIES }} | |
URL_TO_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: submit-results-to-testmo | |
if: always() | |
uses: ./.github/actions/testmo/testmo-threads-submit-playwright | |
with: | |
testmoUrl: ${{ secrets.TESTMO_URL }} | |
testmoToken: ${{ secrets.TESTMO_TOKEN }} | |
testmoRunId: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }} | |
tests-complete: | |
if: '!cancelled()' | |
needs: ["initialize-cloud", "run-tests", "create-run-on-testmo"] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Merge playwright reports | |
uses: ./.github/actions/merge-pw-reports | |
- name: complete testmo report | |
uses: ./.github/actions/testmo/testmo-finish | |
with: | |
testmoUrl: ${{ secrets.TESTMO_URL }} | |
testmoToken: ${{ secrets.TESTMO_TOKEN }} | |
testmoRunId: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }} | |
- name: send message on slack | |
working-directory: ".github" | |
env: | |
run_id: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }} | |
url_to_action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
testmo_token: ${{ secrets.TESTMO_TOKEN }} | |
environment: ${{ needs.initialize-cloud.outputs.BASE_URL }} | |
slack_webhook_url: ${{ secrets.SLACK_QA_STATUSES_WEBHOOK_URL }} | |
ref_name: ${{github.ref_name}} | |
run: | | |
node workflows/postTestsResults.js \ | |
--run_id "$run_id" \ | |
--testmo_token "$testmo_token" \ | |
--slack_webhook_url "$slack_webhook_url" \ | |
--environment "$environment" \ | |
--url_to_action "$url_to_action" \ | |
--ref_name "$ref_name" |