Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AqpXh3hQMMaC74pTjFq4it
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: CI - PHP lint
|
|
description: PHP syntax check (Gitea port of the lint-php job in the reusable ci.yml).
|
|
inputs:
|
|
php:
|
|
required: true
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Use preinstalled PHP ${{ inputs.php }} (peptide-php image)
|
|
id: pre
|
|
shell: bash
|
|
env:
|
|
V: ${{ inputs.php }}
|
|
run: |
|
|
if command -v "php$V" >/dev/null 2>&1; then
|
|
update-alternatives --set php "/usr/bin/php$V" >/dev/null 2>&1 || ln -sf "/usr/bin/php$V" /usr/local/bin/php
|
|
php -v | head -1; echo "hit=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "hit=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Setup PHP ${{ inputs.php }} (fallback when not preinstalled)
|
|
if: ${{ steps.pre.outputs.hit != 'true' }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ inputs.php }}
|
|
coverage: none
|
|
- name: Syntax check all PHP files
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
find . -name '*.php' \
|
|
-not -path './vendor/*' \
|
|
-not -path './node_modules/*' \
|
|
-not -path './.git/*' \
|
|
-not -path './.github/*' \
|
|
-not -path './.gitea/*' \
|
|
-print0 | xargs -0 -r -n1 -P4 php -l > /dev/null
|