ci: 加入 test workflow(lint + unit)
Tests / PHP Lint (push) Successful in 5s
Tests / Unit Tests (push) Successful in 15s

unit job 會一併 checkout 核心 plugin — 本 AddOn 的測試 bootstrap 直接
require 核心的 tests/bootstrap.php。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
This commit is contained in:
2026-07-31 09:20:07 +08:00
parent 0a3b05789e
commit 843a8e2156
+46
View File
@@ -0,0 +1,46 @@
name: Tests
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
jobs:
lint:
name: PHP Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check PHP syntax
run: |
find . -name "*.php" ! -path "./vendor/*" ! -path "./tests/*" -print0 | xargs -0 -n1 php -l
echo "PHP syntax OK"
unit:
name: Unit Tests
runs-on: ubuntu-latest
# The suite boots off the core plugin's test bootstrap, so the core must be
# checked out next to this AddOn under wp-content/plugins/.
steps:
- uses: actions/checkout@v4
with:
path: 2meet-data-optimizer-hivepress-addon
- name: Checkout core plugin
uses: actions/checkout@v4
with:
repository: wpdev/2meet-data-optimizer
path: 2meet-data-optimizer
- name: Install dependencies
working-directory: 2meet-data-optimizer-hivepress-addon
run: composer install --no-interaction --prefer-dist
- name: Install core dev dependencies (test bootstrap needs them)
working-directory: 2meet-data-optimizer
run: composer install --no-interaction --prefer-dist
- name: Run unit tests
working-directory: 2meet-data-optimizer-hivepress-addon
run: php vendor/bin/phpunit --configuration phpunit.xml --testdox