Skip to content

Commit dadb3e9

Browse files
committed
Add Playwright config documentation and update workflow README
- Add docs/config/playwright.md for E2E testing documentation - Update .github/workflows/README.md with all workflow details - Include code-quality, deploy-wporg, and release workflows
1 parent ce384b0 commit dadb3e9

Some content is hidden

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

45 files changed

+4735
-29
lines changed

.devcontainer/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# WordPress Block Plugin Development Container
2+
FROM mcr.microsoft.com/devcontainers/php:1-8.1-bullseye
3+
4+
# Install additional PHP extensions
5+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get -y install --no-install-recommends \
7+
default-mysql-client \
8+
libzip-dev \
9+
libpng-dev \
10+
libjpeg-dev \
11+
libwebp-dev \
12+
subversion \
13+
unzip \
14+
wget \
15+
&& docker-php-ext-configure gd --with-jpeg --with-webp \
16+
&& docker-php-ext-install -j$(nproc) gd mysqli pdo_mysql zip \
17+
&& apt-get clean \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# Install WP-CLI
21+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
22+
&& chmod +x wp-cli.phar \
23+
&& mv wp-cli.phar /usr/local/bin/wp
24+
25+
# Install Composer
26+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
27+
28+
# Install Node.js and npm (LTS version)
29+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
30+
&& apt-get install -y nodejs \
31+
&& npm install -g npm@latest
32+
33+
# Set up PHP configuration
34+
RUN echo "memory_limit=512M" >> /usr/local/etc/php/conf.d/memory.ini \
35+
&& echo "upload_max_filesize=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
36+
&& echo "post_max_size=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
37+
&& echo "max_execution_time=300" >> /usr/local/etc/php/conf.d/timeout.ini
38+
39+
# Create workspace directory
40+
WORKDIR /workspace
41+
42+
# Set up non-root user
43+
ARG USERNAME=vscode
44+
ARG USER_UID=1000
45+
ARG USER_GID=$USER_UID
46+
47+
# Ensure proper permissions
48+
RUN chown -R $USERNAME:$USERNAME /workspace
49+
50+
USER $USERNAME
51+
52+
# Default command
53+
CMD ["sleep", "infinity"]

.devcontainer/README.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
````markdown
2+
# Development Container
3+
4+
This directory contains configuration for VS Code Dev Containers, providing a consistent Docker-based development environment.
5+
6+
## Overview
7+
8+
```mermaid
9+
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#1e4d78', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#15354f', 'lineColor': '#333333', 'secondaryColor': '#f0f0f0', 'tertiaryColor': '#e8e8e8', 'background': '#ffffff', 'mainBkg': '#1e4d78', 'textColor': '#333333', 'nodeBorder': '#15354f', 'clusterBkg': '#f8f9fa', 'clusterBorder': '#dee2e6', 'titleColor': '#333333'}}}%%
10+
flowchart TB
11+
subgraph Container["Dev Container"]
12+
PHP["PHP 8.1"]
13+
Node["Node.js 20"]
14+
Composer["Composer"]
15+
WPCLI["WP-CLI"]
16+
end
17+
18+
subgraph Services["Docker Services"]
19+
WP["WordPress<br/>:8080"]
20+
MySQL["MariaDB<br/>:3306"]
21+
PMA["phpMyAdmin<br/>:8081"]
22+
Mail["MailHog<br/>:8025"]
23+
end
24+
25+
Container --> WP
26+
WP --> MySQL
27+
PMA --> MySQL
28+
WP --> Mail
29+
```
30+
31+
## Quick Start
32+
33+
1. **Install Prerequisites:**
34+
- [Docker Desktop](https://www.docker.com/products/docker-desktop)
35+
- [VS Code](https://code.visualstudio.com/)
36+
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
37+
38+
2. **Open in Container:**
39+
- Open this folder in VS Code
40+
- Click "Reopen in Container" when prompted
41+
- Wait for the container to build (first time only)
42+
43+
3. **Access Services:**
44+
- WordPress: http://localhost:8080
45+
- phpMyAdmin: http://localhost:8081
46+
- MailHog: http://localhost:8025
47+
48+
## Files
49+
50+
### `devcontainer.json`
51+
52+
VS Code Dev Container configuration:
53+
54+
- Node.js 20 and PHP 8.1 environments
55+
- Recommended VS Code extensions
56+
- Port forwarding configuration
57+
- Post-create and post-start commands
58+
59+
### `docker-compose.yml`
60+
61+
Docker Compose services:
62+
63+
| Service | Port | Description |
64+
|---------|------|-------------|
65+
| `wordpress` | 8080 | WordPress with plugin mounted |
66+
| `db` | 3306 | MariaDB database |
67+
| `phpmyadmin` | 8081 | Database management UI |
68+
| `mailhog` | 8025 | Email testing (SMTP: 1025) |
69+
70+
### `Dockerfile`
71+
72+
Custom container image with:
73+
74+
- PHP 8.1 with extensions (gd, mysqli, zip)
75+
- Node.js 20 LTS
76+
- Composer
77+
- WP-CLI
78+
- Development tools
79+
80+
## Usage
81+
82+
### Starting the Environment
83+
84+
```bash
85+
# Using VS Code (recommended)
86+
# Click "Reopen in Container" or run command:
87+
# Remote-Containers: Reopen in Container
88+
89+
# Using Docker Compose directly
90+
cd .devcontainer && docker-compose up -d
91+
```
92+
93+
### WordPress CLI
94+
95+
```bash
96+
# Access WP-CLI
97+
wp --info
98+
99+
# Create admin user
100+
wp user create admin admin@example.com --role=administrator --user_pass=admin
101+
102+
# Activate plugin/theme
103+
wp plugin activate {{slug}}
104+
wp theme activate {{theme_slug}}
105+
```
106+
107+
### Database Access
108+
109+
```bash
110+
# Connect to MySQL
111+
mysql -h db -u wordpress -pwordpress wordpress
112+
113+
# Or use phpMyAdmin at http://localhost:8081
114+
```
115+
116+
### Email Testing
117+
118+
All emails are captured by MailHog:
119+
120+
- SMTP: localhost:1025
121+
- Web UI: http://localhost:8025
122+
123+
## Customization
124+
125+
### Adding PHP Extensions
126+
127+
Edit `Dockerfile`:
128+
129+
```dockerfile
130+
RUN docker-php-ext-install -j$(nproc) your-extension
131+
```
132+
133+
### Adding VS Code Extensions
134+
135+
Edit `devcontainer.json`:
136+
137+
```json
138+
"customizations": {
139+
"vscode": {
140+
"extensions": [
141+
"your.extension-id"
142+
]
143+
}
144+
}
145+
```
146+
147+
### Changing PHP/Node Versions
148+
149+
Edit `devcontainer.json` features:
150+
151+
```json
152+
"features": {
153+
"ghcr.io/devcontainers/features/node:1": {
154+
"version": "20"
155+
},
156+
"ghcr.io/devcontainers/features/php:1": {
157+
"version": "8.2"
158+
}
159+
}
160+
```
161+
162+
## Troubleshooting
163+
164+
### Container Won't Start
165+
166+
```bash
167+
# Rebuild container
168+
docker-compose down -v
169+
docker-compose build --no-cache
170+
docker-compose up -d
171+
```
172+
173+
### Database Connection Issues
174+
175+
```bash
176+
# Check if MySQL is running
177+
docker-compose ps
178+
179+
# Restart database
180+
docker-compose restart db
181+
```
182+
183+
### Permission Issues
184+
185+
```bash
186+
# Fix file permissions
187+
sudo chown -R $(whoami):$(whoami) .
188+
```
189+
190+
## Related Documentation
191+
192+
- [VS Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers)
193+
- [Docker Compose](https://docs.docker.com/compose/)
194+
- [WP-CLI Commands](https://developer.wordpress.org/cli/commands/)
195+
196+
````

.devcontainer/devcontainer.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"name": "WordPress Block Plugin Development",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "devcontainer",
5+
"workspaceFolder": "/workspace",
6+
7+
"features": {
8+
"ghcr.io/devcontainers/features/node:1": {
9+
"version": "20"
10+
},
11+
"ghcr.io/devcontainers/features/php:1": {
12+
"version": "8.1",
13+
"installComposer": true
14+
},
15+
"ghcr.io/devcontainers/features/git:1": {}
16+
},
17+
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"bmewburn.vscode-intelephense-client",
22+
"wongjn.php-sniffer",
23+
"esbenp.prettier-vscode",
24+
"dbaeumer.vscode-eslint",
25+
"stylelint.vscode-stylelint",
26+
"EditorConfig.EditorConfig",
27+
"GitHub.copilot",
28+
"wordpresstoolbox.wordpress-toolbox",
29+
"ms-azuretools.vscode-docker"
30+
],
31+
"settings": {
32+
"editor.formatOnSave": true,
33+
"editor.defaultFormatter": "esbenp.prettier-vscode",
34+
"[php]": {
35+
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
36+
},
37+
"eslint.validate": [
38+
"javascript",
39+
"javascriptreact"
40+
],
41+
"stylelint.validate": [
42+
"css",
43+
"scss",
44+
"postcss"
45+
],
46+
"files.associations": {
47+
"*.php": "php"
48+
},
49+
"intelephense.environment.includePaths": [
50+
"/wordpress",
51+
"/workspace"
52+
],
53+
"terminal.integrated.defaultProfile.linux": "bash"
54+
}
55+
}
56+
},
57+
58+
"forwardPorts": [8080, 8443, 3306],
59+
60+
"postCreateCommand": "npm ci && composer install",
61+
62+
"postStartCommand": "npm run env:start",
63+
64+
"remoteUser": "vscode",
65+
66+
"portsAttributes": {
67+
"8080": {
68+
"label": "WordPress",
69+
"onAutoForward": "notify"
70+
},
71+
"8443": {
72+
"label": "WordPress (HTTPS)",
73+
"onAutoForward": "silent"
74+
},
75+
"3306": {
76+
"label": "MySQL",
77+
"onAutoForward": "silent"
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)