Update/artifact version #37
Workflow file for this run
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: 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 | |
jobs: | |
e2e: | |
name: '${{ matrix.browser }} - WP ${{ matrix.wp }}' | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
# TODO: add back Firefox once support is more mature. | |
include: | |
- browser: 'chrome' | |
wp: 'latest' | |
snapshots: true | |
- browser: 'chrome' | |
wp: '5.3.6' | |
snapshots: false | |
steps: | |
- name: Cancel previous | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- 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 }}' | |
- name: Cache node modules | |
uses: pat-s/[email protected] | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
env: | |
cache-name: cache-node-modules | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: none | |
tools: composer:v2.1.1 | |
- 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 }} | |
if: ( matrix.snapshots ) && ( github.event.pull_request.draft == false ) | |
- name: Run E2E tests | |
run: npm run test:e2e | |
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 |