Skip to content

Commit 560536f

Browse files
committed
Merge branch 'card-79239-extend' into latest
2 parents ef6b474 + f7d62af commit 560536f

433 files changed

Lines changed: 36105 additions & 440 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.distignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ webpack.config.js
3636
wp-cli.local.yml
3737
yarn.lock
3838
tests
39+
test-results
40+
playwright-report
41+
playwright.config.ts
42+
playwright
3943
node_modules
4044
*.sql
4145
*.tar.gz

.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# =============================================================================
2+
# EmbedPress E2E Test Configuration
3+
# =============================================================================
4+
# Copy to .env and update values:
5+
# cp .env.example .env
6+
7+
# Base URL of the WordPress site to test against
8+
E2E_BASE_URL=http://localhost:8080
9+
10+
# WordPress admin credentials
11+
WP_ADMIN_USER=admin
12+
WP_ADMIN_PASS=admin
13+
14+
# Subscriber credentials (for content protection tests)
15+
SUBSCRIBER_USER=subscriber
16+
SUBSCRIBER_PASS=subscriber

.github/workflows/ci.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [master, development, latest]
6+
push:
7+
branches: [development, latest]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
# ============================================================
15+
# JavaScript: Lint + Type Check + Test + Build
16+
# ============================================================
17+
js:
18+
name: JS (Lint, Test, Build)
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: npm
27+
28+
- run: npm ci
29+
30+
- name: ESLint
31+
run: npm run lint
32+
33+
- name: Vitest
34+
run: npm test -- --reporter=verbose
35+
36+
- name: Build
37+
run: npm run build
38+
39+
# ============================================================
40+
# PHP: Lint + Unit Tests
41+
# ============================================================
42+
php:
43+
name: PHP ${{ matrix.php }} (Unit Tests)
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
php: ['8.0', '8.1', '8.2']
49+
services:
50+
mysql:
51+
image: mysql:8.0
52+
env:
53+
MYSQL_ROOT_PASSWORD: root
54+
MYSQL_DATABASE: embedpress_tests
55+
ports:
56+
- 3306:3306
57+
options: >-
58+
--health-cmd="mysqladmin ping -h localhost"
59+
--health-interval=10s
60+
--health-timeout=5s
61+
--health-retries=3
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- uses: shivammathur/setup-php@v2
67+
with:
68+
php-version: ${{ matrix.php }}
69+
extensions: mysqli, mbstring, intl
70+
coverage: xdebug
71+
tools: phpunit:9, composer
72+
73+
- name: Install Composer dependencies
74+
run: composer install --no-interaction --prefer-dist
75+
76+
- name: Run PHPUnit (unit suite)
77+
run: phpunit --testsuite unit --colors=always --coverage-clover build/logs/clover.xml
78+
env:
79+
EP_UNIT_TESTS: 1
80+
81+
# ============================================================
82+
# PHP Code Quality
83+
# ============================================================
84+
phpcs:
85+
name: PHP CodeSniffer
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- uses: shivammathur/setup-php@v2
91+
with:
92+
php-version: '8.2'
93+
tools: cs2pr, phpcs, composer
94+
95+
- name: Install WPCS
96+
run: |
97+
composer global require wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer --no-interaction
98+
99+
- name: Run PHPCS
100+
run: phpcs --standard=phpcs.xml --report=checkstyle | cs2pr
101+
continue-on-error: true
102+
103+
# ============================================================
104+
# E2E: Playwright Tests (WordPress + Chromium)
105+
# ============================================================
106+
e2e:
107+
name: E2E Tests
108+
runs-on: ubuntu-latest
109+
services:
110+
mysql:
111+
image: mysql:8.0
112+
env:
113+
MYSQL_ROOT_PASSWORD: root
114+
MYSQL_DATABASE: embedpress
115+
MYSQL_USER: wordpress
116+
MYSQL_PASSWORD: wordpress
117+
ports:
118+
- 3306:3306
119+
options: >-
120+
--health-cmd="mysqladmin ping -h localhost"
121+
--health-interval=10s
122+
--health-timeout=5s
123+
--health-retries=3
124+
125+
steps:
126+
- uses: actions/checkout@v4
127+
128+
- uses: actions/setup-node@v4
129+
with:
130+
node-version: 20
131+
cache: npm
132+
133+
- uses: shivammathur/setup-php@v2
134+
with:
135+
php-version: '8.2'
136+
extensions: mysqli, mbstring, gd, intl
137+
tools: wp-cli
138+
139+
- name: Install Node dependencies
140+
run: npm ci
141+
142+
- name: Build assets
143+
run: npm run build
144+
145+
- name: Install Playwright browsers
146+
run: npx playwright install chromium
147+
148+
- name: Setup WordPress
149+
run: |
150+
# Download WordPress
151+
wp core download --path=/tmp/wordpress --allow-root
152+
153+
# Configure
154+
wp config create --path=/tmp/wordpress \
155+
--dbname=embedpress --dbuser=wordpress --dbpass=wordpress \
156+
--dbhost=127.0.0.1 --allow-root
157+
158+
wp config set WP_DEBUG true --raw --path=/tmp/wordpress --allow-root
159+
160+
# Install
161+
wp core install --path=/tmp/wordpress \
162+
--url=http://localhost:8080 \
163+
--title="EmbedPress E2E" \
164+
--admin_user=admin --admin_password=admin \
165+
--admin_email=test@test.com --skip-email --allow-root
166+
167+
# Link plugin
168+
ln -s ${{ github.workspace }} /tmp/wordpress/wp-content/plugins/embedpress
169+
170+
# Activate
171+
wp plugin activate embedpress --path=/tmp/wordpress --allow-root
172+
173+
# Set permalinks
174+
wp rewrite structure '/%postname%/' --hard --path=/tmp/wordpress --allow-root
175+
176+
# Start PHP built-in server
177+
php -S localhost:8080 -t /tmp/wordpress &
178+
179+
# Wait for server
180+
sleep 3
181+
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 || true
182+
183+
- name: Run Playwright E2E tests
184+
run: npx playwright test
185+
env:
186+
WP_BASE_URL: http://localhost:8080
187+
188+
- uses: actions/upload-artifact@v4
189+
if: failure()
190+
with:
191+
name: playwright-report
192+
path: playwright-report/
193+
retention-days: 7
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Reusable workflow: builds the EmbedPress plugin zip using the 10up action
2+
# and uploads it as a short-lived artifact. Called by qa.yml so the zip is
3+
# built once and shared across all QA jobs. Also runnable standalone via
4+
# workflow_dispatch for a one-off build.
5+
6+
name: QA - Create Plugin Zip
7+
8+
permissions: read-all
9+
10+
on:
11+
workflow_dispatch: # Manual trigger only
12+
workflow_call:
13+
outputs:
14+
artifact-name:
15+
description: "The name of the uploaded artifact"
16+
value: ${{ jobs.build.outputs.artifact-name }}
17+
18+
jobs:
19+
build:
20+
name: Build plugin zip
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 5
23+
outputs:
24+
artifact-name: ${{ steps.upload-plugin-artifact.outputs.artifact-name }}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
# - name: Build plugin
30+
# run: |
31+
# composer install --no-dev
32+
# npm install
33+
# npm run build
34+
35+
- name: Generate zip
36+
id: upload-plugin-artifact
37+
uses: 10up/action-wordpress-plugin-build-zip@stable
38+
with:
39+
retention-days: 3 # Optional; defaults to 5

.github/workflows/dist-archive.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)