ci(gitea): run CI in a prebuilt PHP image instead of setup-php bootstrap
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AqpXh3hQMMaC74pTjFq4it
This commit is contained in:
@@ -6,7 +6,20 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup PHP ${{ inputs.php }}
|
||||
- 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 }}
|
||||
|
||||
@@ -10,7 +10,18 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
- name: Use preinstalled PHP 8.1 (peptide-php image)
|
||||
id: pre
|
||||
shell: bash
|
||||
run: |
|
||||
if command -v php8.1 >/dev/null 2>&1 && command -v composer >/dev/null 2>&1; then
|
||||
update-alternatives --set php /usr/bin/php8.1 >/dev/null 2>&1 || ln -sf /usr/bin/php8.1 /usr/local/bin/php
|
||||
php -v | head -1; echo "hit=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "hit=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Setup PHP (fallback when not preinstalled)
|
||||
if: ${{ steps.pre.outputs.hit != 'true' }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
@@ -27,6 +38,9 @@ runs:
|
||||
"wp-coding-standards/wpcs:^3.0" \
|
||||
"phpcsstandards/phpcsutils:^1.0" \
|
||||
"phpcsstandards/phpcsextra:^1.0"
|
||||
# Without setup-php's `tools: phpcs`, phpcs/phpcbf come from the global
|
||||
# composer bin dir (WPCS pulls in squizlabs/php_codesniffer).
|
||||
composer global config bin-dir --absolute 2>/dev/null | tail -1 >> "$GITHUB_PATH"
|
||||
|
||||
- name: Auto-fix with phpcbf (PR only, commit back if changed)
|
||||
if: ${{ github.event_name == 'pull_request' && inputs.autofix == 'true' }}
|
||||
|
||||
@@ -21,7 +21,20 @@ runs:
|
||||
shell: bash
|
||||
run: command -v svn >/dev/null || (sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends subversion)
|
||||
|
||||
- name: Setup PHP ${{ inputs.php }}
|
||||
- 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 && command -v composer >/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 }}
|
||||
|
||||
Reference in New Issue
Block a user