Linting configs (PHPCS, ESLint, Stylelint), Forgejo CI pipeline, WordPress health check, PHP linter, strain migration tool, and Docker local dev environment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
# Forgejo Actions CI Pipeline for Weedops WordPress Themes/Plugins
|
|
# Place in .forgejo/workflows/ of your repo
|
|
|
|
name: Weedops CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
lint-php:
|
|
name: PHP Linting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.2'
|
|
tools: composer, cs2pr
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
composer global require wp-coding-standards/wpcs
|
|
composer global require phpcompatibility/phpcompatibility-wp
|
|
phpcs --config-set installed_paths $(composer global config home)/vendor/wp-coding-standards/wpcs
|
|
|
|
- name: Run PHPCS
|
|
run: phpcs --standard=WordPress --extensions=php --ignore=vendor,node_modules .
|
|
|
|
lint-js:
|
|
name: JavaScript Linting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install ESLint
|
|
run: npm install -g eslint
|
|
|
|
- name: Run ESLint
|
|
run: eslint --ext .js assets/ js/ 2>/dev/null || true
|
|
|
|
theme-check:
|
|
name: WordPress Theme Check
|
|
runs-on: ubuntu-latest
|
|
needs: [lint-php]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Validate style.css header
|
|
run: |
|
|
if [ -f style.css ]; then
|
|
echo "Checking style.css theme header..."
|
|
grep -q "Theme Name:" style.css || (echo "ERROR: Missing Theme Name" && exit 1)
|
|
grep -q "Text Domain:" style.css || (echo "ERROR: Missing Text Domain" && exit 1)
|
|
echo "Theme header OK"
|
|
fi
|
|
|
|
- name: Check required template files
|
|
run: |
|
|
for file in index.php style.css; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "ERROR: Missing required file: $file"
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "Required files present"
|
|
|
|
deploy-staging:
|
|
name: Deploy to Staging
|
|
runs-on: ubuntu-latest
|
|
needs: [lint-php, lint-js, theme-check]
|
|
if: github.ref == 'refs/heads/develop'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Deploy via rsync
|
|
run: |
|
|
echo "Deploy to staging would run here"
|
|
echo "Target: weedops.site staging environment"
|