Repository navigation
171 lines (144 loc) · 5.76 KB
/
Copy pathtest.yml
File metadata and controls
171 lines (144 loc) · 5.76 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Test
on:
workflow_dispatch:
push:
branches: [ develop, trunk ]
pull_request:
types: [ opened, synchronize, reopened ]
# Cancel superseded runs on the same PR.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
# The release zip, built once and shared by every E2E job.
build:
uses: ./.github/workflows/build-release-zip.yml
permissions:
contents: read
# Runs against the release zip rather than the source tree, so packaging
# bugs (a runtime file caught by .distignore) fail here, not after release.
e2e:
name: E2E / WP ${{ matrix.wp }}
needs: build
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
wp: [ '6.9', latest, trunk ]
env:
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download the release zip
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ${{ github.event.repository.name }}
path: release/insert-special-characters
# Mount the unzipped release in place of the checkout. Both entries must
# name the same source, or wp-env mounts two sources on one path.
- name: Point the test environment at the release zip
run: |
echo '{"plugins":["./release/insert-special-characters"],"mappings":{"/wp-content/plugins/insert-special-characters":"./release/insert-special-characters"}}' > .wp-env.test.override.json
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Start the test environment
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
command: npm run wp-env:test start
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
# Only the chromium project runs.
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
- name: Run E2E tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: npm run test:e2e
- name: Upload E2E artifacts
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-results-wp-${{ matrix.wp }}
path: artifacts/test-results
retention-days: 7
if-no-files-found: ignore
phpunit:
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }}${{ matrix.multisite && ' multisite' || '' }}
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
wp: [ '6.9', latest, trunk ]
multisite: [ false ]
include:
- { php: '8.5', wp: '6.9', multisite: true }
- { php: '8.5', wp: latest, multisite: true }
- { php: '8.5', wp: trunk, multisite: true }
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
# Lets the container write files the runner user owns.
- name: Configure environment variables
run: |
echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV"
echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Same PHP on the runner as in the container, so Composer resolves for it.
- name: Set up PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Start the test environment
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
command: npm run wp-env:test start
- name: Log versions
run: |
npm run wp-env:test -- run cli php -- -v
npm run wp-env:test -- run cli wp core version
- name: Run PHPUnit
run: npm run ${{ matrix.multisite && 'test:php:multisite' || 'test:php' }}