Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMCS-5353 - Update QAT tests #15

Merged
merged 14 commits into from
Jan 23, 2023
67 changes: 63 additions & 4 deletions .github/workflows/qat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ name: QAT

on:
workflow_call:
inputs:
SITE_URL:
default: ''
description: 'Site URL'
required: false
type: string
THEME_NAME:
default: ''
description: 'WP Theme'
required: false
type: string

secrets:
BITBUCKET_READ_ONLY_SSH_KEY:
required: true
Expand All @@ -14,12 +26,59 @@ permissions:
jobs:
playwright:
name: Playwright
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
rnagatsukapmc marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: 90
if: false
env:
FEATURE_BRANCH_NAME: $(echo "${{ github.head_ref || github.ref_name }}" | sed -e 's/feature\/\(.*\)/\1/' | tr '[:upper:]' '[:lower:]')
NPM_QAT_SCRIPT: "qat:debug"
if: ${{ github.repository != 'penske-media-corp/github-workflows-wordpress' }}

steps:
- name: Prepare environment
uses: penske-media-corp/github-action-wordpress-test-setup@main
with:
bitbucket_read_only_ssh_key: "${{ secrets.BITBUCKET_READ_ONLY_SSH_KEY }}"
github_read_only_ssh_key: "${{ secrets.GITHUB_READ_ONLY_SSH_KEY }}"
nodejs: 1

- name: Check QAT Script and Feature Branch
run: |
has_qat=`jq -r '.scripts|to_entries[]|select(.key=="${{ env.NPM_QAT_SCRIPT }}")|.key' package.json 2>/dev/null | head -n 1 | wc -l`
if [ $has_qat -eq 1 ] && [[ "${{ github.head_ref || github.ref_name }}" =~ 'feature/' ]]; then
echo "RUN_QAT=true" >> $GITHUB_ENV
else
echo "Not a feature branch or qat script not found. Skipping Playwright tests."
echo "RUN_QAT=false" >> $GITHUB_ENV
fi

- name: Check PMCQA
if: ${{ env.RUN_QAT == 'true' }} && ${{ inputs.THEME_NAME != '' }} && ${{ inputs.SITE_URL != '' }}
timeout-minutes: 10
run: |
hash_url="https://${{ env.FEATURE_BRANCH_NAME }}.${{ inputs.SITE_URL }}/wp-content-vipgo-sites/${{ env.FEATURE_BRANCH_NAME }}/themes/vip/${{ inputs.THEME_NAME }}/version-hash"
rnagatsukapmc marked this conversation as resolved.
Show resolved Hide resolved
echo "HASH_URL: $hash_url"
hash=`curl --insecure $hash_url`
until [[ $hash == ${{ github.sha }} ]]; do
echo -n "Waiting for Jenkins Deployment ... \n"
hash=`curl --insecure $hash_url`
sleep 5
done

- name: Install Playwright
if: ${{ env.RUN_QAT == 'true' }}
run: |
. "$NVM_DIR/nvm.sh"

nvm install
nvm use

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick (install will install and use, or just use if it's already installed)

Suggested change
nvm install
nvm use
nvm install

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


npm ci
npx playwright install --with-deps
rnagatsukapmc marked this conversation as resolved.
Show resolved Hide resolved

- name: Run Playwright tests
if: ${{ env.RUN_QAT == 'true' }}
run: |
echo "Not implemented"
exit 0
if [ "${{ inputs.SITE_URL }}" != '' ]; then
export ENVIRONMENT_URL="https://${{ env.FEATURE_BRANCH_NAME }}.${{ inputs.SITE_URL }}"
fi
xvfb-run npm run ${{ env.NPM_QAT_SCRIPT }}
rnagatsukapmc marked this conversation as resolved.
Show resolved Hide resolved