ED-11261 #517
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: Elementor-ScreenShotter | |
on: | |
pull_request: | |
merge_group: | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
run: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 20 | |
env: | |
screenshotter_config_path: ${{ github.workspace }}/tests/screenshotter/config.js | |
strategy: | |
fail-fast: false | |
matrix: | |
wordpress_versions: [ 'latest' ] | |
name: ScreenShotter - WordPress ${{ matrix.wordpress_versions }} | |
steps: | |
- name: Startup MySQL service | |
run: sudo systemctl start mysql.service | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Check if this is only a changelog PR | |
id: changelog_diff_files | |
uses: technote-space/get-diff-action@v6 | |
with: | |
# PATTERNS are: | |
# Everything: **/* | |
# Everything in directories starting with a period: .*/**/* | |
# Not readme.txt: !readme.txt | |
PATTERNS: | | |
**/* | |
.*/**/* | |
!readme.txt | |
- name: Install Node.js 18.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Install Elementor-ScreenShotter | |
if: steps.changelog_diff_files.outputs.diff | |
run: | ##### TO DO: Remove all sudo | |
sudo ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm | |
sudo chown -R $USER /usr/local/lib/node_modules | |
sudo chown -R $USER /usr/local/bin/ | |
npm i -g @elementor/screenshotter | |
npm i -g grunt-cli | |
- name: Install Dependencies | |
if: steps.changelog_diff_files.outputs.diff | |
run: | | |
elementor-screenshotter-install --config=${screenshotter_config_path} --debug=true | |
- name: Prepare Test | |
if: steps.changelog_diff_files.outputs.diff | |
run: | # Enable the container experiment & enable import SVG | |
cd /tmp/wordpress | |
wp elementor experiments activate container,nested-elements | |
wp option update elementor_unfiltered_files_upload 1 | |
wp option update blogdescription 'Just another WordPress site' # WP >= 6.1 | |
- name: Import Templates | |
if: steps.changelog_diff_files.outputs.diff | |
run: | | |
elementor-screenshotter-import-templates --config=${screenshotter_config_path} --debug=true | |
- name: Build Package & Run Test | |
if: steps.changelog_diff_files.outputs.diff | |
run: | | |
elementor-screenshotter-run-test --config=${screenshotter_config_path} --debug=true | |
- name: Clean up report data | |
if: failure() && steps.changelog_diff_files.outputs.diff | |
run: | | |
npm i canvas@^2.8.0 merge-images@^2.0.0 | |
node ./.github/scripts/screenshotter-cleanup.js | |
- uses: actions/upload-artifact@master | |
if: failure() && steps.changelog_diff_files.outputs.diff | |
with: | |
name: backstop-output | |
path: /tmp/wordpress/backstop_data | |
- uses: actions/upload-artifact@master | |
if: failure() && steps.changelog_diff_files.outputs.diff | |
with: | |
name: backstop-summary-core | |
path: /tmp/merged-screenshots |