1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Update GitHub Actions workflow to remove PHP 8.0, add common extensions, and enforce strict validation

This commit is contained in:
Daniel Neto 2025-08-12 11:14:10 -03:00
parent 97f3642ed6
commit 4a540ee196

View file

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest] operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] php-versions: ['8.1', '8.2', '8.3', '8.4']
name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }} name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
@ -22,13 +22,29 @@ jobs:
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: pcre extensions: pcre, mbstring, xml, curl, gd, mysql, zip, intl # Added common extensions
coverage: none # Disable coverage for faster builds
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
- name: Validate composer.json and composer.lock - name: Validate composer.json and composer.lock
run: composer validate run: composer validate --strict
- name: Lint - name: Lint PHP files
run: | run: |
set -e # Exit on any error
lintPaths=() lintPaths=()
lintPaths+=("${GITHUB_WORKSPACE}/admin") lintPaths+=("${GITHUB_WORKSPACE}/admin")
lintPaths+=("${GITHUB_WORKSPACE}/feed") lintPaths+=("${GITHUB_WORKSPACE}/feed")
@ -37,18 +53,18 @@ jobs:
lintPaths+=("${GITHUB_WORKSPACE}/objects") lintPaths+=("${GITHUB_WORKSPACE}/objects")
lintPaths+=("${GITHUB_WORKSPACE}/view") lintPaths+=("${GITHUB_WORKSPACE}/view")
lintPaths+=("${GITHUB_WORKSPACE}/index.php") lintPaths+=("${GITHUB_WORKSPACE}/index.php")
echo "Starting PHP lint check..."
for lintPath in "${lintPaths[@]}" for lintPath in "${lintPaths[@]}"
do do
for file in `find "$lintPath"` if [ -e "$lintPath" ]; then
echo "Checking: $lintPath"
find "$lintPath" -name "*.php" -o -name "*.phtml" | while read -r file
do do
EXTENSION="${file##*.}" php -l "$file" || exit 1
if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ] done
then else
RESULTS=`php -l "$file"` echo "Warning: Path $lintPath does not exist"
if [ "$RESULTS" != "No syntax errors detected in $file" ]
then
echo $RESULTS
fi
fi fi
done done
done echo "PHP lint check completed successfully!"