Skip to content

Merge pull request #192 from rtCamp/update/artifact-version #193

Merge pull request #192 from rtCamp/update/artifact-version

Merge pull request #192 from rtCamp/update/artifact-version #193

Workflow file for this run

name: E2E Tests
on:
push:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '!.github/workflows/tests-e2e.yml'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'readme.txt'
branches:
- main
- release/*
pull_request:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '!.github/workflows/tests-e2e.yml'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'readme.txt'
types:
- opened
- reopened
- synchronize
- ready_for_review
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
e2e:
name: '${{ matrix.browser }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: ${{ matrix.experimental == true }}
strategy:
matrix:
# TODO: add back Firefox once support is more mature.
include:
- browser: 'chrome'
wp: 'latest'
snapshots: true
- browser: 'chrome'
wp: '5.8-RC4'
experimental: true
snapshots: false
- browser: 'chrome'
wp: '5.5'
snapshots: false
steps:
- name: Checkout
uses: actions/checkout@v2
# See https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
- name: Install libgbm1
run: sudo apt-get install libgbm1
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
cache: npm
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
# TODO: Remove need for `npm install puppeteer`.
- name: Install dependencies
run: |
npm ci
npm install puppeteer
composer install --prefer-dist --no-progress --no-interaction
env:
CI: true
PUPPETEER_PRODUCT: ${{ matrix.browser }}
- name: Build plugin
run: npm run build:js
env:
# TODO: remove eventually
DISABLE_PREVENT: true
DISABLE_QUICK_TIPS: true
- name: Start Docker environment
run: npm run env:start
env:
COMPOSE_INTERACTIVE_NO_CLI: true
WP_VERSION: ${{ matrix.wp }}
- name: Run E2E tests with percy
run: npm run test:e2e:percy
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_E2E }}
WP_VERSION: ${{ matrix.wp }}
if: ( matrix.snapshots ) && ( github.event.pull_request.draft == false )
- name: Run E2E tests
run: npm run test:e2e
env:
WP_VERSION: ${{ matrix.wp }}
if: ( ! matrix.snapshots ) || ( github.event.pull_request.draft == true )
- name: Stop Docker environment
run: npm run env:stop
if: always()
env:
COMPOSE_INTERACTIVE_NO_CLI: true