All checks were successful
Deploy Feature Branch to Test / PHP Syntax Check (push) Successful in 34s
Deploy Feature Branch to Test / CSS Lint (stylelint) (push) Successful in 1m12s
Deploy Feature Branch to Test / HTML Lint (htmlhint) (push) Successful in 1m10s
Lint / PHP Syntax Check (push) Successful in 32s
Lint / CSS Lint (stylelint) (push) Successful in 1m14s
Lint / HTML Lint (htmlhint) (push) Successful in 1m9s
Lint / PHP Syntax Check (pull_request) Successful in 32s
Lint / CSS Lint (stylelint) (pull_request) Successful in 1m11s
Lint / HTML Lint (htmlhint) (pull_request) Successful in 1m9s
Deploy Feature Branch to Test / Deploy to Test Environment (push) Successful in 24s
- Add PHP syntax check to lint-staged via scripts/lint-php.sh - Add lint:php script to package.json - Update lint script to include PHP checks - Create scripts/safe-commit.sh for AI agent use - Update deploy-test.yml: lint jobs as gate before deploy - Add branch protection for main requiring status checks - Update AGENTS.md with pre-commit hook rules for agents Also addresses #53: CI requires lint checks before merge Co-authored-by: Claw <claw@openclaw.local>
131 lines
3.9 KiB
YAML
Executable File
131 lines
3.9 KiB
YAML
Executable File
name: Deploy Feature Branch to Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "feature/**"
|
|
|
|
jobs:
|
|
lint-php:
|
|
name: PHP Syntax Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install PHP
|
|
run: apt-get update -qq && apt-get install -y -qq php-cli > /dev/null 2>&1
|
|
|
|
- name: PHP Lint
|
|
run: |
|
|
errors=0
|
|
while IFS= read -r file; do
|
|
if ! php -l "$file" > /dev/null 2>&1; then
|
|
echo "❌ Syntax error in $file"
|
|
php -l "$file"
|
|
errors=1
|
|
fi
|
|
done < <(find . -name "*.php" -not -path "./vendor/*")
|
|
if [ "$errors" -eq 1 ]; then
|
|
echo "::error::PHP lint check failed"
|
|
exit 1
|
|
fi
|
|
echo "✅ All PHP files pass syntax check"
|
|
|
|
lint-css:
|
|
name: CSS Lint (stylelint)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Node.js & stylelint
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
|
npm install -g stylelint stylelint-config-standard stylelint-prettier > /dev/null 2>&1
|
|
|
|
- name: CSS Lint
|
|
run: |
|
|
npx stylelint "**/*.css" --config .stylelintrc.json --allow-empty-input
|
|
echo "✅ All CSS files pass lint"
|
|
|
|
lint-html:
|
|
name: HTML Lint (htmlhint)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Node.js & htmlhint
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
|
npm install -g htmlhint > /dev/null 2>&1
|
|
|
|
- name: HTML Lint
|
|
run: |
|
|
npx htmlhint "**/*.html" --config .htmlhintrc
|
|
echo "✅ All HTML files pass lint"
|
|
|
|
deploy:
|
|
name: Deploy to Test Environment
|
|
runs-on: ubuntu-latest
|
|
needs: [lint-php, lint-css, lint-html]
|
|
container:
|
|
volumes:
|
|
- /var/www/test/html:/deploy
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Show branch info
|
|
run: |
|
|
echo "=== Deploying branch: ${{ gitea.ref_name }} ==="
|
|
echo "=== Commit: ${{ gitea.sha }} ==="
|
|
echo "=== By: ${{ gitea.actor }} ==="
|
|
echo "=== All lint checks passed ✅ ==="
|
|
date
|
|
|
|
- name: Deploy to test environment
|
|
run: |
|
|
echo "Syncing files to test environment..."
|
|
apt-get update -qq && apt-get install -y -qq rsync > /dev/null 2>&1 || true
|
|
|
|
rsync -av --delete \
|
|
--exclude='.git' \
|
|
--exclude='.gitea' \
|
|
--exclude='.husky' \
|
|
--exclude='.prettierrc' \
|
|
--exclude='.prettierignore' \
|
|
--exclude='.stylelintrc.json' \
|
|
--exclude='.htmlhintrc' \
|
|
--exclude='.gitignore' \
|
|
--exclude='.dockerignore' \
|
|
--exclude='.continue' \
|
|
--exclude='Dockerfile' \
|
|
--exclude='nginx.conf' \
|
|
--exclude='eslint.config.js' \
|
|
--exclude='package.json' \
|
|
--exclude='package-lock.json' \
|
|
--exclude='docs/' \
|
|
--exclude='AGENTS.md' \
|
|
--exclude='README.md' \
|
|
--exclude='scripts/' \
|
|
./ /deploy/
|
|
|
|
echo "✅ Deployment complete!"
|
|
|
|
- name: Set permissions
|
|
run: |
|
|
chown -R 33:33 /deploy/ 2>/dev/null || true
|
|
chmod -R 755 /deploy/ 2>/dev/null || true
|
|
echo "✅ Permissions set"
|
|
|
|
- name: Deployment summary
|
|
run: |
|
|
echo "=========================================="
|
|
echo " 🚀 Deployment Summary"
|
|
echo "=========================================="
|
|
echo " Branch: ${{ gitea.ref_name }}"
|
|
echo " Commit: ${{ gitea.sha }}"
|
|
echo " Target: http://178.104.150.0:6427/"
|
|
echo " Lint: ✅ All checks passed"
|
|
echo " Time: $(date)"
|
|
echo "=========================================="
|