Skip to content

feat: template cloud integration #2797

feat: template cloud integration

feat: template cloud integration #2797

Workflow file for this run

name: Test e2e for JS
on:
pull_request:
types: [opened, synchronize, ready_for_review]
branches-ignore:
- "update_dependencies"
jobs:
e2e:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
# setup the composer cache (vendor) with github actions cache and the cache dir defined in the previous step
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# run composer install
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
# setup the node cache (node_modules) with github actions cache
- name: Cache Node - npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-cache-
- name: npm ci
run: |
npm ci
- name: Make dev build
run: |
npm run build-dev
- name: Create License File
run: |
printf "{\"key\":\"${{ secrets.OTTER_PRO_LICENSE }}\"}" > license.json
- name: Setup WP Env
run: |
npm run wp-env start
- name: Install Playwright
run: |
npm install -g playwright-cli
npx playwright install
- name: Playwright Blocks
run: |
npm run test:e2e:playwright && echo "PLAYWRIGHT_SUCCESS=true" >> $GITHUB_ENV || echo "PLAYWRIGHT_SUCCESS=false" >> $GITHUB_EN
continue-on-error: true
- name: Performance check
run: |
npm run test:performance
cat artifacts/post-editor.performance-results.json
- name: Upload tests artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: artifact
path: ./artifacts
retention-days: 1
- name: Print the results
run: |
RESULTS=$(jq -r 'to_entries|map("\(.key): \(.value)")|join(", ")' artifacts/post-editor.performance-results.json)
FLAKY_TEST_STATUS="Playwright Test Status: $PLAYWRIGHT_SUCCESS"
echo "::set-output name=PERFORMANCE_OUTPUT::$RESULTS"
echo "::set-output name=FLAKY_TEST_STATUS::$FLAKY_TEST_STATUS"
id: summary
- name: Comment
uses: NejcZdovc/comment-pr@v2
with:
file: "e2e-summary.md"
identifier: "GITHUB_E2E_SUMMARY"
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
PERFORMANCE_OUTPUT: ${{ steps.summary.outputs.PERFORMANCE_OUTPUT }}
FLAKY_TEST_STATUS: ${{ steps.summary.outputs.FLAKY_TEST_STATUS }}