-
-
Notifications
You must be signed in to change notification settings - Fork 33
112 lines (108 loc) · 3.9 KB
/
Copy pathe2e.yml
File metadata and controls
112 lines (108 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Split out of the former `tests.yml`. Keep the job name `test-e2e`, since that is what the
# status checks on existing pull requests are called.
#
# This is by far the most expensive workflow — nine matrix entries, each starting a
# WordPress environment and a browser — so it is the one that benefits most from both the
# path filter and the concurrency group.
#
# Only `pull_request` is filtered — `push` to a major branch deliberately runs everything.
# A merge carries the same diff the pull request carried, so a filter that is too narrow
# would skip the check on the pull request *and* on the merge, and the gap would never
# surface. The push run is also the only one that tests the code as it actually landed:
# pull request checks run against a merge commit computed when they started, which goes
# stale once the base branch moves on. Pull requests are where the volume is — many pushes
# per review — so the filter still saves nearly everything it did before.
name: E2E tests
on:
push:
branches:
- master
- v3
pull_request:
paths:
- '**.php'
# The unit suite and its stubs cannot affect an end-to-end run, and this workflow is
# nine environments wide, so exclude them from the `**.php` match above.
- '!tests/Unit/**'
- '!tests/_stubs/**'
- '**.js'
- '**.css'
- 'composer.json'
- 'composer.lock'
- 'package.json'
- 'package-lock.json'
- 'playwright.config.ts'
- 'tests/e2e/**'
- '.wp-env.json'
- '.github/workflows/e2e.yml'
# The shared PHP setup is part of this workflow's setup, so a change to it has to run
# this workflow as well.
- '.github/actions/setup-php/**'
# Allow forcing a full run by hand, for example before cutting a release.
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '8.5'
wordpress: 'nightly'
- php: '8.5'
wordpress: 'latest'
- php: '8.5'
wordpress: '7.0'
- php: '8.4'
wordpress: '6.9'
- php: '8.3'
wordpress: '6.8'
- php: '8.2'
wordpress: '6.7'
- php: '8.1'
wordpress: '6.6'
- php: '8.0'
wordpress: '6.0'
- php: '7.4'
wordpress: '5.6'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '22'
cache: 'npm'
- name: Install npm dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Setup PHP and install dependencies
uses: ./.github/actions/setup-php
with:
php-version: ${{ matrix.php }}
composer-flags: '--no-dev --optimize-autoloader'
- name: Configure wp-env for matrix
run: |
case "${{ matrix.wordpress }}" in
nightly) CORE="WordPress/WordPress" ;;
latest) CORE="https://wordpress.org/latest.zip" ;;
*) CORE="https://wordpress.org/wordpress-${{ matrix.wordpress }}.zip" ;;
esac
echo "{\"core\":\"${CORE}\",\"phpVersion\":\"${{ matrix.php }}\"}" | tee .wp-env.override.json
- name: Start wp-env
run: npm run env:start
- name: Run E2E tests
run: npm run test:e2e
- name: Upload test report on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report-php${{ matrix.php }}-wp${{ matrix.wordpress }}
path: tests/e2e/report/
retention-days: 7
- name: Stop wp-env
if: always()
run: npm run env:stop