Files
moko-platform/templates/workflows/validate-wordpress-project.yml
T

104 lines
3.0 KiB
YAML

name: Validate WordPress Project
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
jobs:
validate:
name: Validate WordPress Project
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Checkout MokoStandards
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: mokoshalb/MokoStandards
path: .mokostandards
ref: main
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, xml, json, fileinfo, zip, mysqli
- name: Install MokoStandards dependencies
working-directory: .mokostandards
run: composer install --prefer-dist --no-progress
- name: Run WordPress validation
id: validate
run: |
php .mokostandards/api/plugin_validate.php \
--project-path . \
--project-type wordpress \
--json > validation-results.json
cat validation-results.json
if jq -e '.valid == false' validation-results.json > /dev/null; then
echo "::error::Project validation failed"
exit 1
fi
- name: Run health check
id: health
run: |
php .mokostandards/api/plugin_health_check.php \
--project-path . \
--project-type wordpress \
--json > health-results.json
cat health-results.json
SCORE=$(jq -r '.score' health-results.json)
echo "Health Score: $SCORE/100"
- name: Collect metrics
id: metrics
run: |
php .mokostandards/api/plugin_metrics.php \
--project-path . \
--project-type wordpress \
--json > metrics-results.json
cat metrics-results.json
- name: Check release readiness
id: readiness
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
run: |
php .mokostandards/api/plugin_readiness.php \
--project-path . \
--project-type wordpress \
--json > readiness-results.json
cat readiness-results.json
- name: WordPress Coding Standards
continue-on-error: true
run: |
composer global require wp-coding-standards/wpcs
phpcs --standard=WordPress --extensions=php ./ || true
- name: Upload validation artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: wordpress-validation-results
path: |
validation-results.json
health-results.json
metrics-results.json
readiness-results.json
retention-days: 30