Skip to content

Add new workflow for the automated tests #2

Add new workflow for the automated tests

Add new workflow for the automated tests #2

name: Run automated tests
on:
pull_request:
types: [labeled]
jobs:
run-automated-tests:
if: github.event.label.name == 'Ready for QA'
name: run-automated-tests
timeout-minutes: 90
runs-on:
group: k8s-runners-qa
labels: qa
strategy:
fail-fast: false
matrix:
tag: [StudioUI]
outputs:
runner-name: ${{ steps.create-gh-repo-self-hosted-runner.outputs.runner-name }}
studioUi: ${{ steps.defineTestTag.outputs.studioUi }}
tag: ${{ steps.defineTestTag.outputs.tag }}
steps:
# This step automatically creates assign needed test tag and other test variables in github ENV storage
- name: define test tag
id: defineTestTag
run: |
SETTAG="StudioUI"
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo "workspace=https://chiligrafx-dev.com/environments/4283baaa-43dd-4dc6-a5c9-a97790caa278/studio/templates/6bfc1c70-2268-4e1f-96ad-25359277ecec?&workspace=latest" >> $GITHUB_OUTPUT
echo "studioUi=https://chiligrafx-dev.com/environments/43b59331-9a98-4c64-8c5a-2a98d279fff9/studio/projects/9cf26f44-6891-4855-b09d-3db76b919189?studio-ui=pr_builds/$(echo $PR_NUMBER)" >> $GITHUB_OUTPUT
echo "$SETTAG"
echo "tag=$SETTAG" >> $GITHUB_OUTPUT
# This step for check job variables need to run tests
- name: check settings
id: checkSet
run: |
echo Test tag: "${{ matrix.tag }}"
echo Test branch: "${GITHUB_HEAD_REF}"
echo StudioUi URL: "${{ steps.defineTestTag.outputs.studioUi }}"
# This step runs automated tests
- name: Test execution inside selfhosted container
id: selfRunner
run: |
pwd
export STUDIOUI="${{ steps.defineTestTag.outputs.studioUi }}"
git clone --depth 1 --branch "main" "${{ secrets.AZURE_QA_TEST_URL }}" .
sudo chown -R 1001:1001 "/home/runner/.npm"
sudo npm i
sudo chown -R runner:runner *
echo '"STUDIOUI":"${{ steps.defineTestTag.outputs.studioUi}}"' > url.json
cat url.json
gauge run --env ciSelf --tags "${{ matrix.tag }}" --max-retries-count=2
# This step for upload artifacts
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-report-${{ matrix.tag }}
path: /runner/_work/studio-ui/studio-ui/reports
retention-days: 14
- name: Notification in MS Teams
uses: neonidian/teams-notify-build-status@v3
if: always() && steps.selfRunner.outcome == 'failure'
with:
webhookUrl: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK_URI }}
message: Failed on the test automation job of the PR ${{ github.event.pull_request.title }} in the project ${{ github.repository }}
status: ${{ job.status }}
title: Failure in project ${{ github.repository }}
titleBackgroundColor: ${{ job.status }}
env:
SHOULD_DISPLAY_VIEW_RUN_BUTTON: true
SHOULD_DISPLAY_ACTOR_LABEL: true