Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WordPress CI:如何使用 GitHub Action 自動測試你的設定、插件或者模版
Search
Hong Kong WordPress Meetup
November 04, 2025
Technology
23
0
Share
WordPress CI:如何使用 GitHub Action 自動測試你的設定、插件或者模版
Hong Kong WordPress Meetup
November 04, 2025
More Decks by Hong Kong WordPress Meetup
See All by Hong Kong WordPress Meetup
Hong Kong WordPress Meetup #96
hkwp
0
16
Hong Kong WordPress Meetup #95
hkwp
0
21
Why Design Matters: First Impressions Count
hkwp
0
25
Hong Kong WordPress Meetup #94
hkwp
0
22
AI 召喚師的奧義:WordPress 網站生成術
hkwp
0
26
Hong Kong WordPress Meetup #93
hkwp
0
27
The 5 Essential UI Principles You Can Apply to Your Website Today
hkwp
0
30
使用WordPress作為街頭訪問工具(Presented)
hkwp
0
20
Hong Kong WordPress Meetup #92
hkwp
0
34
Other Decks in Technology
See All in Technology
【技術書典20】OpenFOAM(自宅で深める流体解析)流れと熱移動(2)
kamakiri1225
0
380
Every Conversation Counts
kawaguti
PRO
0
170
クラウドネイティブ DB はいかにして制約を 克服したか? 〜進化歴史から紐解く、スケーラブルアーキテクチャ設計指針〜
hacomono
PRO
6
780
要件定義の精度を高めるための型と生成AIの活用 / Using Types and Generative AI to Improve the Accuracy of Requirements Definition
haru860
0
310
そのSLO 99.9%、本当に必要ですか? 〜優先度付きSLOによる責任共有の設計思想〜 / Is that 99.9% SLO really necessary? Design philosophy of shared responsibility through prioritized SLOs
vtryo
0
430
AI時代に越境し、 組織を変えるQAスキルの正体 / QA Skills for Transforming an Organization
mii3king
5
4.2k
(きっとたぶん)人材育成や教育のような何かの話
sejima
0
670
知ってた?JavaScriptの"正しさ"を検証するテストが5万以上もあること(Test262)
riyaamemiya
1
170
会社説明資料|株式会社ギークプラス ソフトウェア事業部
geekplus_tech
0
210
10サービス以上のメール到達率改善を地道に継続的に進めている話 / Continue to improve email delivery rates across multiple services
yamaguchitk333
3
120
アプリブロック機能のつくりかたと、AIとHTMLの不合理な相性の良さについて
kumamotone
1
220
OWASP APTSを眺めてみた
su3158
0
130
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
190
Mobile First: as difficult as doing things right
swwweet
225
10k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
350
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
For a Future-Friendly Web
brad_frost
183
10k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Transcript
WordPress CI 如何使用 GitHub Action 自動測試你的設定、插件或者模版
今次會講啲乜? • 點解要自動測試? • 試啲乜? • 有乜麻煩位? • 測試常用工具 •
自動化平台及工具 • WordPress CI • 點樣一步步邁向自動測試 • 進階少少應用
今次唔會講啲乜? • 點用 git • 點用 composer • PSR /
Autoload • Modern PHP
大家嚟到,有心聽,不妨參與多啲 • 唔明開聲問吧 • 嘗試照顧不同程度朋友 • 希望大家唔好嫌慢,但覺得太快請開聲
點解要做自動測試?
點解要做自動測試?
點解要做自動測試? • AI 幻覺 • AI 爛貨 (AI Slop) •
世人總要重覆錯誤 (Regression) • 數齊啲貨,確保真係做咗
點解要做自動測試? • AI 幻覺 • AI 爛貨 (AI Slop) •
世人總要重覆錯誤 (Regression) • 數齊啲貨,確保真係做咗
應該測試啲乜?
測試啲乜? • 元件測試 (Unit Test) 測試「零件」,比如 Function / Class •
框架測試 (Framework Test) 針對編程框架的銜接做測試,假設框架正常 • 需求測試 (Acceptance Test / End-to-end Test) 盡量模擬真實環境,測試最終交付的功能性
測試啲乜? • 元件測試 (Unit Test) 測試「零件」,比如 Function / Class(今日唔講) •
框架測試 (Framework Test) 針對編程框架的銜接做測試,假設框架正常 (今日唔講) • 需求測試 (Acceptance Test / End-to-end Test) 盡量模擬真實環境,測試最終交付的功能性
有乜嘢麻煩位?
有乜嘢麻煩位? • WordPress 要好多嘢先行到 • 我啲 Plugin / Theme 要裝好哂
WordPress 之後再 activate • 我有自己資料同設定 • 有唔同 PHP 版本我想試 • 點樣扮瀏覽器先?要扮用戶登入要 cookie 喎,仲有 Javascript…
正常一個 WordPress 要點先測試到?
正常一個 WordPress 要點先測試到? WordPress (Source Code) MySQL / MariaDB PHP-FPM
/ mod_php Apache / Nginx Chrome / Firefox / Edge 用戶操作 Codeception WebDriver WordPress CI
仲有啲乜工具可以方便做自動測試?
仲有啲乜工具可以方便做自動測試? 本地 Docker 平台 Docker GitHub Action
一步步邁向做自動測試?
一步步邁向做自動測試? • 加入 Git 版本控制 (如果未用緊) • 先寫本地測試 • 本地運行
• 加入 GitHub Actions • 慢慢加入 Workflow,將本地測試在 GitHub 平台上跑
本地測試
PHPUnit
PHP Unit • 老牌子 • 多人用 • Codeception 聯乘 •
有其他選擇: ◦ PHPSpec ◦ Kahlan
PHP Unit • 時間有限,今日唔試比大家睇
WebDriver
WebDriver • Selenium • W3C 互聯網標準 2018 年起為推薦標準 (W3C Recommendation)
• 支援的瀏覽器: ◦ Chrome / Chromium ◦ Firefox ◦ Edge ◦ Safari ◦ IE
Composer
Composer • 管理相依關係 • PSR-4 autoload • Modern PHP 常用
• 方便的方法分享腳本 (script)
Codeception + WebDriver
Demo • Docker https://www.docker.com/ • Docker Compose https://docs.docker.com/compose/install • WordPress
CI https://github.com/impressible-wp /wordpress-ci/pkgs/container/wordpress-ci
Demo • Find Docker Container docker ps • Run Command
in Docker Container docker exec -it container-id command command-arg1 … • WordPress CLI (wp-cli) https://wp-cli.org/ docker exec -it container-id wp …
本地測試 WordPress (Source Code) MySQL / MariaDB PHP-FPM / mod_php
Apache / Nginx Chrome / Firefox / Edge 用戶操作 Codeception WebDriver WordPress CI
Demo • WebDriver https://www.w3.org/TR/webdriver1/ • Codeception https://codeception.com • Codeception: WebDriver
module https://codeception.com/docs/modules/WebDriver
注意 • Codeception 預設用 PHPBrowser 模擬瀏覽器 • 使用 codecept init
指令產生的 acceptance 用 PHPBrowser • 要改 codeception.yml 與及 tests/Acceptance.yml • 令佢使用 WebDriver module • 不同的瀏覽器,需使用不同的 WebDriver 驅動程式,設定稍有不同
本地測試 WordPress (Source Code) MySQL / MariaDB PHP-FPM / mod_php
Apache / Nginx Chrome / Firefox / Edge 用戶操作 Codeception WebDriver WordPress CI
GitHub 自動測試
WordPress CI on GitHub Action • WordPress CI on GitHub
Marketplace https://github.com/marketplace/actions/wordpress-ci
WordPress CI on GitHub Action
WordPress CI on GitHub Action
WordPress CI on GitHub Action
WordPress CI on GitHub Action
WordPress CI on GitHub Action • Run Commands in WordPress
CI container (i.e. "Server") wpci-cmd command command-arg1 … • WordPress CLI (wp-cli) wpci-cmd wp …
點樣再進一步?
有圖有真相,截圖
模擬用戶登入
匯入資料庫做測試
錯誤處理
大致係咁,有乜想問?
持續交付 Continuous Delivery (CD)
WordPress CI 如何使用 GitHub Action 自動測試你的設定、插件或者模版 (完)