59c9b698b7
從 wp-data-optimizer v3.4.6 移植 5 個 integration 測試檔,並新增 tests/integration/bootstrap.php(複用核心的 integration bootstrap,不重複 與 WP stub)+ phpunit-integration.xml + CI integration job。
80 lines
2.5 KiB
YAML
80 lines
2.5 KiB
YAML
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
|
|
|
|
integration:
|
|
name: Integration Tests
|
|
runs-on: ubuntu-latest
|
|
# Host-mode runner: no service containers. Uses the host MariaDB, same as
|
|
# the core plugin's integration job.
|
|
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 integration tests
|
|
working-directory: 2meet-data-optimizer-hivepress-addon
|
|
env:
|
|
TMDO_TEST_DB_HOST: 127.0.0.1
|
|
TMDO_TEST_DB_USER: dbo
|
|
TMDO_TEST_DB_PASS: ${{ secrets.TMDO_TEST_DB_PASS }}
|
|
TMDO_TEST_DB_NAME: wp_wpdo_test
|
|
run: php vendor/bin/phpunit --configuration phpunit-integration.xml --testdox
|