Skip to content

Run tests on PHP 8.4 #1180

Run tests on PHP 8.4

Run tests on PHP 8.4 #1180

Workflow file for this run

name: E2E Tests
on:
push:
branches:
- main
pull_request:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
e2e-tests:
name: 'E2E Tests (${{ matrix.wp }}) (${{ matrix.shard }})'
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
wp: ['latest']
shard: ['1/4', '2/4', '3/4', '4/4']
experimental: [false]
include:
- wp: 'trunk'
shard: '1/4'
experimental: true
- wp: 'trunk'
shard: '2/4'
experimental: true
- wp: 'trunk'
shard: '3/4'
experimental: true
- wp: 'trunk'
shard: '4/4'
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Build plugin
run: npm run build
env:
WP_DEVTOOL: source-map
# To get CSS source maps
NODE_ENV: development
- name: Configure WordPress version
run: |
if [[ $WP_VERSION == 'trunk' ]]; then
echo "Using WordPress trunk"
echo "{\"core\":\"WordPress/WordPress#master\"}" >> .wp-env.override.json
fi
env:
WP_VERSION: ${{ matrix.wp }}
- name: Install WordPress
run: |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env
npm run wp-env start
# Ensure the wp-content/languages folder exists and is writable.
# See https://github.com/WordPress/gutenberg/issues/22515
# and https://github.com/WordPress/gutenberg/tree/trunk/packages/env#installing-a-plugin-or-theme-on-the-development-instance
- name: Prepare tests
run: |
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1)
cd $WP_ENV_DIR
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language core install de_CH de_DE es_ES fr_FR it_IT
cd -
- name: Run tests
run: npm run test:e2e -- --shard=${{ matrix.shard }}
env:
COLLECT_COVERAGE: ${{ matrix.wp == 'trunk' }}
- name: Upload code coverage report
uses: codecov/codecov-action@v4.5.0
with:
file: artifacts/e2e-coverage/coverage/codecov.json
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.wp == 'trunk' }}
- name: Get debug 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: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifacts