Skip to content

Commit e4d4c6d

Browse files
committed
Update workflow README with comprehensive documentation
- Update .github/workflows/README.md with all workflow details - Include code-quality, deploy-wporg, and release workflows - Add workflow triggers and configuration sections
1 parent 4ffefa1 commit e4d4c6d

Some content is hidden

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

41 files changed

+4401
-69
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 Theme 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: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
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 theme 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 [email protected] --role=administrator --user_pass=admin
101+
102+
# Activate theme
103+
wp theme activate lswp-theme
104+
```
105+
106+
### Database Access
107+
108+
```bash
109+
# Connect to MySQL
110+
mysql -h db -u wordpress -pwordpress wordpress
111+
112+
# Or use phpMyAdmin at http://localhost:8081
113+
```
114+
115+
### Email Testing
116+
117+
All emails are captured by MailHog:
118+
119+
- SMTP: localhost:1025
120+
- Web UI: http://localhost:8025
121+
122+
## Customization
123+
124+
### Adding PHP Extensions
125+
126+
Edit `Dockerfile`:
127+
128+
```dockerfile
129+
RUN docker-php-ext-install -j$(nproc) your-extension
130+
```
131+
132+
### Adding VS Code Extensions
133+
134+
Edit `devcontainer.json`:
135+
136+
```json
137+
"customizations": {
138+
"vscode": {
139+
"extensions": [
140+
"your.extension-id"
141+
]
142+
}
143+
}
144+
```
145+
146+
### Changing PHP/Node Versions
147+
148+
Edit `devcontainer.json` features:
149+
150+
```json
151+
"features": {
152+
"ghcr.io/devcontainers/features/node:1": {
153+
"version": "20"
154+
},
155+
"ghcr.io/devcontainers/features/php:1": {
156+
"version": "8.2"
157+
}
158+
}
159+
```
160+
161+
## Troubleshooting
162+
163+
### Container Won't Start
164+
165+
```bash
166+
# Rebuild container
167+
docker-compose down -v
168+
docker-compose build --no-cache
169+
docker-compose up -d
170+
```
171+
172+
### Database Connection Issues
173+
174+
```bash
175+
# Check if MySQL is running
176+
docker-compose ps
177+
178+
# Restart database
179+
docker-compose restart db
180+
```
181+
182+
### Permission Issues
183+
184+
```bash
185+
# Fix file permissions
186+
sudo chown -R $(whoami):$(whoami) .
187+
```
188+
189+
## Related Documentation
190+
191+
- [VS Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers)
192+
- [Docker Compose](https://docs.docker.com/compose/)
193+
- [WP-CLI Commands](https://developer.wordpress.org/cli/commands/)
194+
195+
````

.devcontainer/devcontainer.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"name": "WordPress Block Theme 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+
"*.html": "html"
49+
},
50+
"intelephense.environment.includePaths": [
51+
"/wordpress",
52+
"/workspace"
53+
],
54+
"terminal.integrated.defaultProfile.linux": "bash"
55+
}
56+
}
57+
},
58+
59+
"forwardPorts": [8080, 8443, 3306],
60+
61+
"postCreateCommand": "npm ci && composer install",
62+
63+
"postStartCommand": "npm run env:start",
64+
65+
"remoteUser": "vscode",
66+
67+
"portsAttributes": {
68+
"8080": {
69+
"label": "WordPress",
70+
"onAutoForward": "notify"
71+
},
72+
"8443": {
73+
"label": "WordPress (HTTPS)",
74+
"onAutoForward": "silent"
75+
},
76+
"3306": {
77+
"label": "MySQL",
78+
"onAutoForward": "silent"
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)