Repository navigation
Update centered.php #2848
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-lint-test: | |
| name: Build, Lint & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Reject forbidden paths | |
| run: | | |
| forbidden='node_modules|/build/|tools/scratch|/bin/|vendor/phpunit|vendor/squizlabs' | |
| if git ls-files | grep -E "$forbidden"; then | |
| echo "::error::Forbidden paths are tracked in Git" | |
| exit 1 | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Audit npm dependencies | |
| run: npm audit --audit-level=moderate | |
| continue-on-error: true | |
| - name: Build theme | |
| run: npm run build | |
| # Linting ensures theme.json and JS follow standards | |
| - name: Lint JS/TS & CSS | |
| run: | | |
| npm run lint:js | |
| npm run lint:css | |
| npm run lint:pkg-json | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, intl, dom, curl, json, libxml, xml, xmlwriter | |
| tools: composer, phpcs | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Audit Composer dependencies | |
| run: composer audit --no-interaction | |
| continue-on-error: true | |
| # PHPCS for theme PHP files and integrated audit tool | |
| - name: PHPCS (WordPress Coding Standards) | |
| run: vendor/bin/phpcs | |
| # WPAudit lives only in tools/wpaudit (not a theme Composer package). | |
| - name: WPAudit unit tests | |
| run: | | |
| if [ ! -f tools/wpaudit/composer.json ]; then | |
| echo "::error::tools/wpaudit is missing. It must be committed so CI can run the WPAudit suite." | |
| exit 1 | |
| fi | |
| composer install --no-interaction --no-progress --working-dir=tools/wpaudit | |
| tools/wpaudit/vendor/bin/phpunit -c tools/wpaudit/phpunit.xml | |
| theme-validation: | |
| name: Theme Validation | |
| runs-on: ubuntu-latest | |
| needs: build-lint-test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Build theme | |
| run: npm run build | |
| - name: Validate theme.json | |
| run: | | |
| if [ -f "theme.json" ]; then | |
| node -e " | |
| const fs = require('fs'); | |
| const json = fs.readFileSync('theme.json', 'utf8'); | |
| try { | |
| JSON.parse(json); | |
| console.log('✓ theme.json is valid JSON'); | |
| } catch (e) { | |
| console.error('✗ Invalid JSON in theme.json:', e.message); | |
| process.exit(1); | |
| } | |
| " | |
| fi | |
| - name: Check required theme files | |
| run: | | |
| required_files=("style.css" "index.php" "functions.php" "theme.json") | |
| missing_files=() | |
| for file in "${required_files[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| missing_files+=("$file") | |
| fi | |
| done | |
| if [ ${#missing_files[@]} -gt 0 ]; then | |
| echo "✗ Missing required files: ${missing_files[*]}" | |
| exit 1 | |
| fi | |
| echo "✓ All required theme files present" |