[pull] main from google:main #3881
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/**' | |
- '.storybook/**' | |
- '.wordpress-org/**' | |
- '__mocks__/**' | |
- '__static__/**' | |
- 'tests/**' | |
- '**.md' | |
- '**.yml' | |
- '**.neon.dist' | |
- '**.xml.dist' | |
- 'readme.txt' | |
- '.editorconfig' | |
- '.eslint*' | |
- '.markdownlint*' | |
- '.phpstorm.meta.php' | |
- '.prettier*' | |
- '.stylelint*' | |
- '.github/workflows/**' | |
- '!.github/workflows/tests-e2e.yml' | |
branches: | |
- main | |
- release/* | |
pull_request: | |
# Don't run for irrelevant changes. | |
paths-ignore: | |
- 'docs/**' | |
- '.storybook/**' | |
- '.wordpress-org/**' | |
- '__mocks__/**' | |
- '__static__/**' | |
- 'tests/**' | |
- '**.md' | |
- '**.yml' | |
- '**.neon.dist' | |
- '**.xml.dist' | |
- 'readme.txt' | |
- '.editorconfig' | |
- '.eslint*' | |
- '.markdownlint*' | |
- '.phpstorm.meta.php' | |
- '.prettier*' | |
- '.stylelint*' | |
- '.github/workflows/**' | |
- '!.github/workflows/tests-e2e.yml' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
permissions: | |
contents: read | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the (target) branch name. | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build plugin | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Setup Node | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Setup PHP | |
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 | |
with: | |
php-version: '8.0' | |
coverage: none | |
tools: composer | |
- name: Install dependencies | |
run: npm ci | |
env: | |
PUPPETEER_SKIP_DOWNLOAD: true | |
- name: Install PHP dependencies | |
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a | |
with: | |
composer-options: '--prefer-dist --no-progress --no-interaction' | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 | |
with: | |
bun-version: latest | |
- name: Build plugin | |
run: bun run build:js | |
env: | |
# TODO: remove eventually | |
DISABLE_PREVENT: true | |
DISABLE_QUICK_TIPS: true | |
- name: Bundle plugin | |
run: bun run workflow:build-plugin | |
- name: Upload bundle | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
with: | |
name: web-stories | |
path: build/web-stories | |
e2e: | |
name: '${{ matrix.browser }} - WP ${{ matrix.wp }} (${{ matrix.shard }})' | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
continue-on-error: ${{ matrix.experimental == true }} | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
# TODO: add back Firefox once support is more mature. | |
browser: ['chrome'] | |
wp: ['6.5'] | |
snapshots: [false] | |
experimental: [false] | |
# We want to split up the tests into 2 parts running in parallel. | |
shard: ['1/2', '2/2'] | |
include: | |
- browser: 'chrome' | |
wp: 'latest' | |
snapshots: true | |
shard: '1/2' | |
- browser: 'chrome' | |
wp: 'latest' | |
snapshots: true | |
shard: '2/2' | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f | |
with: | |
disable-file-monitoring: true | |
egress-policy: audit | |
allowed-endpoints: > | |
github.com:443 | |
objects.githubusercontent.com:443 | |
packagist.org:443 | |
registry.npmjs.org:443 | |
storage.googleapis.com:443 | |
docker.io:443 | |
registry-1.docker.io:443 | |
auth.docker.io:443 | |
34.104.35.123:443 | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Download bundle | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | |
with: | |
name: web-stories | |
# 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: Setup Node | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
env: | |
PUPPETEER_PRODUCT: ${{ matrix.browser }} | |
- name: Start Docker environment | |
run: npm run env:start | |
env: | |
COMPOSE_INTERACTIVE_NO_CLI: true | |
WP_VERSION: ${{ matrix.wp }} | |
- name: Get Chromium executable path | |
id: chromium_path | |
run: | | |
CHROMIUM=$(node -p "const puppeteer = require('puppeteer'); puppeteer.executablePath();") | |
echo "chromium_path=${CHROMIUM}" >> $GITHUB_ENV | |
if: ( matrix.snapshots ) && ( github.event.pull_request.draft == false ) | |
- name: Download AMP validator JS | |
id: amp_validator | |
run: | | |
cd $RUNNER_TEMP && curl -O -f -s -S https://cdn.ampproject.org/v0/validator_wasm.js | |
AMP_VALIDATOR_FILE="${RUNNER_TEMP}/validator_wasm.js" | |
echo "validator_file=$AMP_VALIDATOR_FILE" >> $GITHUB_ENV | |
- name: Run E2E tests | |
run: npm run test:e2e -- --shard=$SHARD | |
env: | |
WP_VERSION: ${{ matrix.wp }} | |
SHARD: ${{ matrix.shard }} | |
AMP_VALIDATOR_FILE: ${{ env.validator_file }} | |
- name: Stop Docker environment | |
run: npm run env:stop | |
if: always() | |
env: | |
COMPOSE_INTERACTIVE_NO_CLI: true | |
- name: Get artifact name | |
if: always() | |
run: | | |
ARTIFACT_NAME=${ARTIFACT_NAME//\//-} | |
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV | |
env: | |
ARTIFACT_NAME: failures-artifacts-${{ matrix.wp }}-${{ matrix.shard }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
if: always() | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: build/e2e-artifacts | |
if-no-files-found: ignore |