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:
parent
97f3642ed6
commit
4a540ee196
1 changed files with 32 additions and 16 deletions
48
.github/workflows/validate.yml
vendored
48
.github/workflows/validate.yml
vendored
|
@ -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
|
||||||
do
|
echo "Checking: $lintPath"
|
||||||
EXTENSION="${file##*.}"
|
find "$lintPath" -name "*.php" -o -name "*.phtml" | while read -r file
|
||||||
if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ]
|
do
|
||||||
then
|
php -l "$file" || exit 1
|
||||||
RESULTS=`php -l "$file"`
|
done
|
||||||
if [ "$RESULTS" != "No syntax errors detected in $file" ]
|
else
|
||||||
then
|
echo "Warning: Path $lintPath does not exist"
|
||||||
echo $RESULTS
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
echo "PHP lint check completed successfully!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue